Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _includes/agents/query-agent-usage-limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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).
13 changes: 13 additions & 0 deletions docs/agents/_includes/query_agent.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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()

}
Expand Down
11 changes: 11 additions & 0 deletions docs/agents/_includes/query_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 31 additions & 1 deletion docs/agents/query/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -469,6 +470,35 @@ The conversation history helps the Query Agent understand context from previous

</Tabs>

### `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.

<Tabs className="code" groupId="languages">
<TabItem value="py_agents" label="Python">
<FilteredTextBlock
text={PyCode}
startMarker="# START SuggestQueries"
endMarker="# END SuggestQueries"
language="py"
/>
</TabItem>
<TabItem value="ts_agents" label="JavaScript/TypeScript">
<FilteredTextBlock
text={TSCode}
startMarker="// START SuggestQueries"
endMarker="// END SuggestQueries"
language="ts"
/>
</TabItem>
</Tabs>

## Stream responses

The Query Agent can also stream responses, allowing you to receive the answer as it is being generated.
Expand Down
Loading