@@ -17,7 +17,7 @@ import {
1717 *
1818 * For more information, see the [Weaviate Query Agent Docs](https://weaviate.io/developers/agents/query)
1919 */
20- export class QueryAgentSearcher {
20+ export class QueryAgentSearcher < T > {
2121 //private headers: Record<string, string> = {};
2222 //private connectionHeaders: HeadersInit | undefined;
2323 private agentsHost : string ;
@@ -84,7 +84,7 @@ export class QueryAgentSearcher {
8484 } ;
8585 }
8686
87- async execute ( options : SearchExecutionOptions ) : Promise < SearchModeResponse > {
87+ async execute ( options : SearchExecutionOptions ) : Promise < SearchModeResponse < T > > {
8888 if ( ! this . collections || this . collections . length === 0 ) {
8989 throw Error ( "No collections provided to the query agent." ) ;
9090 }
@@ -101,9 +101,9 @@ export class QueryAgentSearcher {
101101 if ( ! response . ok ) {
102102 await handleError ( await response . text ( ) ) ;
103103 }
104- const parsedResponse = ( await response . json ( ) ) as ApiSearchModeResponse ;
104+ const parsedResponse = ( await response . json ( ) ) as ApiSearchModeResponse < T > ;
105105 const { mappedResponse, apiSearches } =
106- mapSearchOnlyResponse ( parsedResponse ) ;
106+ mapSearchOnlyResponse < T > ( parsedResponse ) ;
107107 // If we successfully mapped the searches, cache them for the next request.
108108 // Since this cache is a private internal value, there's not point in mapping
109109 // back and forth between the exported and API types, so we cache apiSearches
0 commit comments