Skip to content
Open
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
12 changes: 12 additions & 0 deletions docs/agents/_includes/query_agent.mts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ for (const obj of basicSearchResponse.searchResults.objects) {
}
// END BasicSearchQuery

// START RetrievalStrategyExample
const strategyResponse = await qa.search("Find me some vintage shoes under $70", {
filtering: "recall",
limit: 10,
})

for (const obj of strategyResponse.searchResults.objects) {
console.log(`Product: ${obj.properties['name']} - ${obj.properties['price']}`)
}
// END RetrievalStrategyExample


// START DiversityRanking
const diversitySearchResponse = await qa.search("summer shoes", {
limit: 10,
Expand Down
12 changes: 12 additions & 0 deletions docs/agents/_includes/query_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,18 @@ def populate_weaviate(client, overwrite_existing=False):
print(f"Product: {obj.properties['name']} - ${obj.properties['price']}")
# END BasicSearchQuery

# START RetrievalStrategyExample
search_response = qa.search(
"Find me some vintage shoes under $70",
filtering="recall",
limit=10,
)

for obj in search_response.search_results.objects:
print(f"Product: {obj.properties['name']} - ${obj.properties['price']}")
# END RetrievalStrategyExample


# START SearchModeResponseStructure
# SearchModeResponse structure for Python
search_response = qa.search("winter boots for under $100", limit=5)
Expand Down
27 changes: 27 additions & 0 deletions docs/agents/query/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,33 @@ Metadata: {'creation_time': None, 'last_update_time': None, 'distance': None, 'c

</details>

#### `Search` with customized filtering

Search Mode uses query rewriting to transform your original query into one or multiple Weaviate queries, each with either a search query, metadata filters, or both. The `filtering` parameter controls how many Weaviate queries are generated.

- **`"recall"`** (default): Generates multiple Weaviate queries spanning different filters and interpretations of the user query.
- **`"precision"`**: Generates a single Weaviate query targeting the most likely interpretation of the user query.

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

</Tabs>

#### `Search` with pagination

`Search` supports pagination to handle large result sets efficiently:
Expand Down
Loading