-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add embed endpoint #153
Add embed endpoint #153
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.
Just some language nits :)
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.
Overall looks good to me, I agree with the feedback @ssmith-pc left as well.
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.
LGTM, thanks for iterating.
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.
I left a couple more comments related to code samples, but overall looks good to me. Thanks for addressing all the feedback.
Problem
Add embed endpoint for Java SDK to allow users to create embeddings for text data such as passage or query using a specified model. More details on inference api can be found here.
Solution
Users can now call embed endpoint with the following parameters:
String model
: Accepts a string from the specified models .Map<String, Object> parameters
: Acceptsinput_type
andtruncate
as keys with their corresponding values in a Map. The values are expected to be scalar. Please note that the default value oftruncate
is set toEND
if not specified.List<String> inputs
: The list must be of size atleast 1.As a part of this change, I have added a
getInferenceClient()
inPinecone
class to follow a similar pattern with other SDKs. The underlying client usesOkHTTPClient
for REST calls. The methodgetInferenceClient()
returns an instance ofInference
class which I added as a wrapper to the Inference API. So far, this wrapper containsembed()
endpoint only, with the plan of addingrerank()
soon. Lastly, I have added docstrings and updated README with an example of the embed endpoint.Type of Change
Test Plan
Added integration tests.