-
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 integrated inference #181
base: main
Are you sure you want to change the base?
Conversation
HashMap<String, String> inputsMap = new HashMap<>(); | ||
inputsMap.put("text", "Disease prevention"); | ||
SearchRecordsRequestQuery query = new SearchRecordsRequestQuery() | ||
.topK(4) | ||
.inputs(inputsMap); | ||
|
||
List<String> fields = new ArrayList<>(); | ||
fields.add("category"); | ||
fields.add("chunk_text"); | ||
|
||
// Wait for vectors to be upserted | ||
Thread.sleep(5000); | ||
|
||
SearchRecordsResponse recordsResponse = index.searchRecords(namespace, query, fields, null); |
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 think we should consider creating some API abstractions over the SearchRecordsRequestQuery
interface.
For example, it might feel more natural if the user could query with something like:
RecordsQuery query = new TextRecordsQuery("Disease prevention")
.topK(4);
index.searchRecords(namespace, query, ["category", "chunk_text"]);
We could also support ID and vector queries in a similar way?
vectorOperations.setCustomBaseUrl(protocol + config.getHost()); | ||
} | ||
|
||
public void upsertRecords(String namespace, List<UpsertRecord> upsertRecord) throws ApiException { |
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.
Can we add an overload that accepts List<Map<String, Object>>
?
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.
This feels kind of cumbersome:
UpsertRecord record1 = new UpsertRecord();
record1.id("rec1");
record1.putAdditionalProperty("category", "digestive system");
record1.putAdditionalProperty("chunk_text", "Apples are a great source of dietary fiber, which supports digestion and helps maintain a healthy gut.");
ArrayList<UpsertRecord> records = new ArrayList<>();
UpsertRecord record2 = new UpsertRecord();
record2.id("rec2");
record2.putAdditionalProperty("category", "cultivation");
record2.putAdditionalProperty("chunk_text", "Apples originated in Central Asia and have been cultivated for thousands of years, with over 7,500 varieties available today.");
Problem
Add integrated inference to Java SDK.
Solution
The code was already generated since integrated inference was a part of 2025-01 api spec. So as a part of this PR, I have added the following features:
Example:
Type of Change
Test Plan
Added integration test that creates an index associated with a model, upserts and queries records.