@@ -2,10 +2,26 @@ import { WeaviateClient } from "weaviate-client";
22import { QueryAgentResponse } from "./response/response.js" ;
33import { mapResponse } from "./response/response-mapping.js" ;
44
5+ /**
6+ * An agent for executing agentic queries against Weaviate.
7+ *
8+ * Warning:
9+ * Weaviate Agents - Query Agent is an early stage alpha product.
10+ * The API is subject to breaking changes. Please ensure you are using the latest version of the client.
11+ *
12+ * For more information, see the [Weaviate Query Agent Docs](https://weaviate.io/developers/agents/query)
13+ */
514export class QueryAgent {
615 private systemPrompt ?: string ;
716 private agentsHost : string ;
817
18+ /**
19+ * Creates a new QueryAgent instance.
20+ *
21+ * @param client - The Weaviate client instance.
22+ * @param collections - The collections to query.
23+ * @param options - Additional options for the QueryAgent.
24+ */
925 constructor (
1026 private client : WeaviateClient ,
1127 private collections : string [ ] ,
@@ -18,6 +34,13 @@ export class QueryAgent {
1834 this . agentsHost = agentsHost ;
1935 }
2036
37+ /**
38+ * Run the query agent.
39+ *
40+ * @param query - The natural language query string for the agent.
41+ * @param options - Additional options for the run.
42+ * @returns The response from the query agent.
43+ */
2144 async run (
2245 query : string ,
2346 { viewProperties } : QueryAgentRunOptions = { }
@@ -51,11 +74,16 @@ export class QueryAgent {
5174 }
5275}
5376
77+ /** Options for the QueryAgent. */
5478export type QueryAgentOptions = {
79+ /** System prompt to guide the agent's behavior. */
5580 systemPrompt ?: string ;
81+ /** Host of the agents service. */
5682 agentsHost ?: string ;
5783} ;
5884
85+ /** Options for the QueryAgent run. */
5986export type QueryAgentRunOptions = {
87+ /** List of of property names the agent has the ability to view across all collections. */
6088 viewProperties ?: string [ ] ;
6189} ;
0 commit comments