diff --git a/docs/agents/_includes/query_agent.mts b/docs/agents/_includes/query_agent.mts index a671d652..e3011085 100644 --- a/docs/agents/_includes/query_agent.mts +++ b/docs/agents/_includes/query_agent.mts @@ -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, diff --git a/docs/agents/_includes/query_agent.py b/docs/agents/_includes/query_agent.py index d76ef630..0c07ccc3 100644 --- a/docs/agents/_includes/query_agent.py +++ b/docs/agents/_includes/query_agent.py @@ -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) diff --git a/docs/agents/query/usage.md b/docs/agents/query/usage.md index 9d6bbe8e..d2db165f 100644 --- a/docs/agents/query/usage.md +++ b/docs/agents/query/usage.md @@ -282,6 +282,36 @@ Metadata: {'creation_time': None, 'last_update_time': None, 'distance': None, 'c +#### `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. +You should use these when you prefer to get results, even if they don't match every criteria in your query. + +- **`"precision"`**: Generates a single Weaviate query targeting the most likely interpretation of the user query. +You should use this when you want the results to follow your query intent closely, even if that means potentially receiving no results. + + + + + + + + + + + #### `Search` with pagination `Search` supports pagination to handle large result sets efficiently: