-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Openai embedding endpoint #702
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! LGTM!
) -> Result<Json<CompatEmbedResponse>, (StatusCode, Json<ErrorResponse>)> { | ||
metrics::increment_counter!("lorax_request_count"); | ||
tracing::debug!("Input: {}", req.input); | ||
if let StringOrVec::Vec(inputs) = req.input { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOC what's the difference between string or vec as inputs? Is it the vec just a list of strings and why we have a .map call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but we need to handle the case that the input is a string or a list of strings. Rust is a bit weird like that. So you need a special type for that. https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting, good to know!
Adding an OpenAI compatible embedding endpoint.
Also adding a batch embed functionality