Skip to content

Commit c12e0db

Browse files
authored
add target vector parameter for query agent (#4)
1 parent 5f87786 commit c12e0db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/query/agent.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class QueryAgent {
4444
*/
4545
async run(
4646
query: string,
47-
{ viewProperties, context }: QueryAgentRunOptions = {}
47+
{ viewProperties, context, targetVector }: QueryAgentRunOptions = {}
4848
): Promise<QueryAgentResponse> {
4949
const { host, bearerToken, headers } =
5050
await this.client.getConnectionDetails();
@@ -63,6 +63,7 @@ export class QueryAgent {
6363
collection_view_properties: viewProperties,
6464
system_prompt: this.systemPrompt,
6565
previous_response: context ? mapApiResponse(context) : undefined,
66+
target_vector: targetVector,
6667
}),
6768
});
6869

@@ -86,6 +87,14 @@ export type QueryAgentOptions = {
8687
export type QueryAgentRunOptions = {
8788
/** List of of property names the agent has the ability to view across all collections. */
8889
viewProperties?: string[];
90+
/**
91+
* Target vector for the query if a collection uses named vector.
92+
* When multiple collections are provided to the query agent,
93+
* a mapping must be used to map collection names to target vectors.
94+
*/
95+
targetVector?: TargetVector | Record<string, TargetVector>;
8996
/** Previous response from the agent. */
9097
context?: QueryAgentResponse;
9198
};
99+
100+
type TargetVector = string | string[];

0 commit comments

Comments
 (0)