@@ -41,7 +41,7 @@ export class QueryAgent {
4141 collections,
4242 systemPrompt,
4343 agentsHost = "https://api.agents.weaviate.io" ,
44- } : QueryAgentOptions = { }
44+ } : QueryAgentOptions = { } ,
4545 ) {
4646 this . collections = collections ;
4747 this . systemPrompt = systemPrompt ;
@@ -57,7 +57,7 @@ export class QueryAgent {
5757 */
5858 async run (
5959 query : string ,
60- { collections, context } : QueryAgentRunOptions = { }
60+ { collections, context } : QueryAgentRunOptions = { } ,
6161 ) : Promise < QueryAgentResponse > {
6262 const targetCollections = collections ?? this . collections ;
6363 if ( ! targetCollections ) {
@@ -100,23 +100,40 @@ export class QueryAgent {
100100 */
101101 stream (
102102 query : string ,
103- options : QueryAgentStreamOptions & { includeProgress : false ; includeFinalState : false }
103+ options : QueryAgentStreamOptions & {
104+ includeProgress : false ;
105+ includeFinalState : false ;
106+ } ,
104107 ) : AsyncGenerator < StreamedTokens > ;
105108 stream (
106109 query : string ,
107- options : QueryAgentStreamOptions & { includeProgress : false ; includeFinalState ?: true }
110+ options : QueryAgentStreamOptions & {
111+ includeProgress : false ;
112+ includeFinalState ?: true ;
113+ } ,
108114 ) : AsyncGenerator < StreamedTokens | QueryAgentResponse > ;
109115 stream (
110116 query : string ,
111- options : QueryAgentStreamOptions & { includeProgress ?: true ; includeFinalState : false }
117+ options : QueryAgentStreamOptions & {
118+ includeProgress ?: true ;
119+ includeFinalState : false ;
120+ } ,
112121 ) : AsyncGenerator < ProgressMessage | StreamedTokens > ;
113122 stream (
114123 query : string ,
115- options ?: QueryAgentStreamOptions & { includeProgress ?: true ; includeFinalState ?: true }
124+ options ?: QueryAgentStreamOptions & {
125+ includeProgress ?: true ;
126+ includeFinalState ?: true ;
127+ } ,
116128 ) : AsyncGenerator < ProgressMessage | StreamedTokens | QueryAgentResponse > ;
117129 async * stream (
118130 query : string ,
119- { collections, context, includeProgress, includeFinalState } : QueryAgentStreamOptions = { }
131+ {
132+ collections,
133+ context,
134+ includeProgress,
135+ includeFinalState,
136+ } : QueryAgentStreamOptions = { } ,
120137 ) : AsyncGenerator < ProgressMessage | StreamedTokens | QueryAgentResponse > {
121138 const targetCollections = collections ?? this . collections ;
122139
@@ -146,13 +163,13 @@ export class QueryAgent {
146163 include_progress : includeProgress ?? true ,
147164 include_final_state : includeFinalState ?? true ,
148165 } ) ,
149- }
166+ } ,
150167 ) ;
151168
152169 for await ( const event of sseStream ) {
153170 if ( event . event === "error" ) {
154171 await handleError ( event . data ) ;
155- }
172+ }
156173
157174 let output : ProgressMessage | StreamedTokens | QueryAgentResponse ;
158175 if ( event . event === "progress_message" ) {
0 commit comments