-
Notifications
You must be signed in to change notification settings - Fork 1
Add search-only mode #29
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
Changes from 12 commits
d9c371d
21fb90d
9d5c9d7
04d8150
a7f980c
11cef97
019d72f
368bda9
62dd66d
498a659
9749bf2
f78c508
8a0204f
6ae894d
b3f53a8
85c5702
89eaebf
e181535
b6c195f
f43b595
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export * from "./agent.js"; | ||
| export { QueryAgentCollectionConfig } from "./collection.js"; | ||
| export * from "./response/index.js"; | ||
| export * from "./search.js"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import { WeaviateReturn } from "weaviate-client"; | ||
|
|
||
| export type QueryAgentResponse = { | ||
| outputType: "finalState"; | ||
| originalQuery: string; | ||
|
|
@@ -260,3 +262,23 @@ export type StreamedTokens = { | |
| outputType: "streamedTokens"; | ||
| delta: string; | ||
| }; | ||
|
|
||
| export type MappedSearchModeResponse<T> = { | ||
|
||
| originalQuery: string; | ||
| searches?: SearchResult[]; | ||
| usage: Usage; | ||
| totalTime: number; | ||
| searchResults: WeaviateReturn<T>; | ||
| }; | ||
|
|
||
| /** Options for the executing a prepared QueryAgent search. */ | ||
| export type SearchExecutionOptions = { | ||
| /** The maximum number of results to return. */ | ||
| limit?: number; | ||
| /** The offset of the results to return, for paginating through query result sets. */ | ||
| offset?: number; | ||
| }; | ||
|
|
||
| export type SearchModeResponse<T> = MappedSearchModeResponse<T> & { | ||
| next: (options: SearchExecutionOptions) => Promise<SearchModeResponse<T>>; | ||
| }; | ||
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.
Sadly results also probably are returned from API as
underscore_caseand notcamelCase, so we'd have to map it as well to make it developer friendly 😢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.
Argh, good catch! I've adding mapping from the api
snake_casetocamelCase👍 I've also removed all the generics on the types to make this work (we can add them back later if we want, but they were for typing properties but our search results are potentially multi-collection, so maybe didn't make sense anyway 🤷 ).The types of the search result
objectsare also an extension of the Weaviate types, to add acollectionfield (which was missing from the original type).