diff --git a/_includes/agents/query-agent-usage-limits.mdx b/_includes/agents/query-agent-usage-limits.mdx index 6f9e288e..4162666b 100644 --- a/_includes/agents/query-agent-usage-limits.mdx +++ b/_includes/agents/query-agent-usage-limits.mdx @@ -4,5 +4,6 @@ Requests are consumed based on query type: - `Ask`: 4 requests per query - `Search`: 1 request per query +- `Suggest Queries`: 1 request per query This limit may change in the future. For questions about usage limits, contact [product@weaviate.io](mailto:product@weaviate.io). diff --git a/docs/agents/_includes/query_agent.mts b/docs/agents/_includes/query_agent.mts index 585cd2dd..2e8e448f 100644 --- a/docs/agents/_includes/query_agent.mts +++ b/docs/agents/_includes/query_agent.mts @@ -582,6 +582,19 @@ if (basicResponse.missingInformation && basicResponse.missingInformation.length if (!basicResponse.finalAnswer || basicResponse.finalAnswer === '') { throw new Error('Final answer is empty or null'); } + +// START SuggestQueries +const suggestResponse = await qa.suggestQueries({ + collections: ["IRPAPERS"], + numQueries: 3, + instructions: "High-level themes and open-ended exploration", +}); + +for (const suggestedQuery of suggestResponse.queries) { + console.log(suggestedQuery.query); +} +// END SuggestQueries + await client.close() } diff --git a/docs/agents/_includes/query_agent.py b/docs/agents/_includes/query_agent.py index e12e4bb6..c1284b18 100644 --- a/docs/agents/_includes/query_agent.py +++ b/docs/agents/_includes/query_agent.py @@ -674,3 +674,14 @@ async def run_streaming_query(): asyncio.run(run_streaming_query()) # END StreamAsyncResponse + +# START SuggestQueries +response = qa.suggest_queries( + collections=["IRPAPERS"], + num_queries=3, + instructions="High-level themes and open-ended exploration", +) + +for suggested_query in response.queries: + print(suggested_query.query) +# END SuggestQueries diff --git a/docs/agents/query/usage.md b/docs/agents/query/usage.md index 44fc9d19..9d6bbe8e 100644 --- a/docs/agents/query/usage.md +++ b/docs/agents/query/usage.md @@ -208,10 +208,11 @@ For usage example with the async Python client, see the [Async Python client sec ## Querying -The Query Agent supports two query types: +The Query Agent supports three query types: - [**`Search`**](#search) - [**`Ask`**](#ask) +- [**`Suggest Queries`**](#suggest-queries) ### `Search` @@ -469,6 +470,35 @@ The conversation history helps the Query Agent understand context from previous +### `Suggest Queries` + +The Query Agent can suggest queries based on the data in your collections. This is useful for helping users discover what kinds of questions they can ask, or for generating example queries for a new dataset. + +You can optionally specify: + +- `collections`: Override the collections configured at instantiation. +- `num_queries` (`numQueries` in TypeScript): The number of queries to suggest (default: 3). +- `instructions`: Guide the style or focus of the suggested queries. + + + + + + + + + + ## Stream responses The Query Agent can also stream responses, allowing you to receive the answer as it is being generated.