Skip to content

Commit 4845622

Browse files
committed
remove context from ask functions
1 parent c183f83 commit 4845622

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/query/agent.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class QueryAgent {
103103
*/
104104
async ask(
105105
query: string,
106-
{ collections, context }: QueryAgentRunOptions = {},
106+
{ collections }: QueryAgentAskOptions = {},
107107
): Promise<QueryAgentResponse> {
108108
const targetCollections = collections ?? this.collections;
109109
if (!targetCollections) {
@@ -126,7 +126,6 @@ export class QueryAgent {
126126
query,
127127
collections: mapCollections(targetCollections),
128128
system_prompt: this.systemPrompt,
129-
previous_response: context ? mapApiResponse(context) : undefined,
130129
}),
131130
});
132131

@@ -245,28 +244,28 @@ export class QueryAgent {
245244
*/
246245
askStream(
247246
query: string,
248-
options: QueryAgentStreamOptions & {
247+
options: QueryAgentAskStreamOptions & {
249248
includeProgress: false;
250249
includeFinalState: false;
251250
},
252251
): AsyncGenerator<StreamedTokens>;
253252
askStream(
254253
query: string,
255-
options: QueryAgentStreamOptions & {
254+
options: QueryAgentAskStreamOptions & {
256255
includeProgress: false;
257256
includeFinalState?: true;
258257
},
259258
): AsyncGenerator<StreamedTokens | QueryAgentResponse>;
260259
askStream(
261260
query: string,
262-
options: QueryAgentStreamOptions & {
261+
options: QueryAgentAskStreamOptions & {
263262
includeProgress?: true;
264263
includeFinalState: false;
265264
},
266265
): AsyncGenerator<ProgressMessage | StreamedTokens>;
267266
askStream(
268267
query: string,
269-
options?: QueryAgentStreamOptions & {
268+
options?: QueryAgentAskStreamOptions & {
270269
includeProgress?: true;
271270
includeFinalState?: true;
272271
},
@@ -275,10 +274,9 @@ export class QueryAgent {
275274
query: string,
276275
{
277276
collections,
278-
context,
279277
includeProgress,
280278
includeFinalState,
281-
}: QueryAgentStreamOptions = {},
279+
}: QueryAgentAskStreamOptions = {},
282280
): AsyncGenerator<ProgressMessage | StreamedTokens | QueryAgentResponse> {
283281
const targetCollections = collections ?? this.collections;
284282

@@ -304,7 +302,6 @@ export class QueryAgent {
304302
query,
305303
collections: mapCollections(targetCollections),
306304
system_prompt: this.systemPrompt,
307-
previous_response: context ? mapApiResponse(context) : undefined,
308305
include_progress: includeProgress ?? true,
309306
include_final_state: includeFinalState ?? true,
310307
}),
@@ -369,6 +366,12 @@ export type QueryAgentRunOptions = {
369366
context?: QueryAgentResponse;
370367
};
371368

369+
/** Options for the QueryAgent ask. */
370+
export type QueryAgentAskOptions = {
371+
/** List of collections to query. Will override any collections if passed in the constructor. */
372+
collections?: (string | QueryAgentCollectionConfig)[];
373+
};
374+
372375
/** Options for the QueryAgent stream. */
373376
export type QueryAgentStreamOptions = {
374377
/** List of collections to query. Will override any collections if passed in the constructor. */
@@ -381,6 +384,16 @@ export type QueryAgentStreamOptions = {
381384
includeFinalState?: boolean;
382385
};
383386

387+
/** Options for the QueryAgent askStream. */
388+
export type QueryAgentAskStreamOptions = {
389+
/** List of collections to query. Will override any collections if passed in the constructor. */
390+
collections?: (string | QueryAgentCollectionConfig)[];
391+
/** Include progress messages in the stream. */
392+
includeProgress?: boolean;
393+
/** Include final state in the stream. */
394+
includeFinalState?: boolean;
395+
};
396+
384397
/** Options for the QueryAgent search-only run. */
385398
export type QueryAgentSearchOnlyOptions = {
386399
/** The maximum number of results to return. */

0 commit comments

Comments
 (0)