Skip to content

Commit a8f68e5

Browse files
committed
Revert "docs(query-agent): make search-mode filtering a required argument"
This reverts commit 7d55f67.
1 parent 3db17c2 commit a8f68e5

10 files changed

Lines changed: 8 additions & 27 deletions

File tree

_includes/code/llms-txt/python/query_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
print(response.final_answer)
2929

3030
# Retrieval only (no generation)
31-
search_response = qa.search("sci-fi movies", filtering="recall", limit=5)
31+
search_response = qa.search("sci-fi movies", limit=5)
3232
# END llms_query_agent
3333

3434
assert response.final_answer

_includes/code/python/quickstart.short.query_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
qa = QueryAgent(client=client, collections=["Movie"])
1919

2020
# Step 2.3: Perform a query using Search Mode
21-
response = qa.search("Find a cool sci-fi movie.", filtering="recall", limit=1)
21+
response = qa.search("Find a cool sci-fi movie.", limit=1)
2222
# highlight-end
2323

2424
# Print the response

docs/query-agent/_includes/code/query_agent.mts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ clothingResponse.display();
141141
// START BasicSearchQuery
142142
// Perform a search using Search Mode (retrieval only, no answer generation)
143143
const basicSearchResponse = await qa.search("Find me some vintage shoes under $70", {
144-
filtering: "recall",
145144
limit: 10
146145
})
147146

@@ -155,7 +154,6 @@ for (const obj of basicSearchResponse.searchResults.objects) {
155154
// Diversity ranking needs a vectorizer it can resolve. Scope the call to a
156155
// single collection with a target vector so the agent knows what to use.
157156
const diversitySearchResponse = await qa.search("summer shoes", {
158-
filtering: "recall",
159157
limit: 10,
160158
diversityWeight: 0.5,
161159
collections: [{
@@ -181,7 +179,6 @@ basicResponse.display();
181179
// START SearchModeResponseStructure
182180
// SearchModeResponse structure for TypeScript
183181
const searchResponse = await qa.search("winter boots for under $100", {
184-
filtering: "recall",
185182
limit: 5
186183
})
187184

@@ -209,7 +206,6 @@ for (const obj of searchResponse.searchResults.objects) {
209206
// Search with pagination
210207
const responsePage1 = await qa.search(
211208
"Find summer shoes and accessories between $50 and $100 that have the tag 'sale'", {
212-
filtering: "recall",
213209
limit: 3,
214210
})
215211

docs/query-agent/_includes/code/query_agent.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211

212212
# START BasicSearchQuery
213213
# Perform a search using Search Mode (retrieval only, no answer generation)
214-
search_response = qa.search("Find me some vintage shoes under $70", filtering="recall", limit=10)
214+
search_response = qa.search("Find me some vintage shoes under $70", limit=10)
215215

216216
# Access the search results
217217
for obj in search_response.search_results.objects:
@@ -220,7 +220,7 @@
220220

221221
# START SearchModeResponseStructure
222222
# SearchModeResponse structure for Python
223-
search_response = qa.search("winter boots for under $100", filtering="recall", limit=5)
223+
search_response = qa.search("winter boots for under $100", limit=5)
224224

225225
# Access different parts of the response
226226
print(f"Original query: {search_response.searches[0].query}")
@@ -244,7 +244,6 @@
244244
# Search with pagination
245245
response_page_1 = qa.search(
246246
"Find summer shoes and accessories between $50 and $100 that have the tag 'sale'",
247-
filtering="recall",
248247
limit=3,
249248
)
250249

@@ -270,7 +269,6 @@
270269
# START DiversityRanking
271270
search_response = qa.search(
272271
"summer shoes",
273-
filtering="recall",
274272
limit=10,
275273
diversity_weight=0.5,
276274
collections=[

docs/query-agent/_includes/code/query_agent_get_started.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
# START SearchMode
136136
search_response = agent.search(
137137
"Find me some vintage shoes under $70",
138-
filtering="recall",
139138
limit=10,
140139
)
141140

docs/query-agent/_includes/code/quickstart.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ qa = new QueryAgent(client, {
5151
// START BasicSearchQuery
5252
const searchResponse = await qa.search(
5353
"Find me some vintage shoes under $70", {
54-
filtering: "recall",
5554
limit: 10,
5655
});
5756
// END BasicSearchQuery

docs/query-agent/_includes/code/quickstart.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353

5454
# START BasicSearchQuery
5555
search_response = qa.search(
56-
"Find me some vintage shoes under $70",
57-
filtering="recall",
56+
"Find me some vintage shoes under $70",
5857
limit=10
5958
)
6059
# END BasicSearchQuery

docs/query-agent/_includes/code/search_mode.mts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ await populateWeaviate(client);
3939

4040
// START BasicSearchMode
4141
const searchResponse = await qa.search("Find me some vintage shoes under $70", {
42-
filtering: "recall",
4342
limit: 10,
4443
});
4544

@@ -51,7 +50,6 @@ for (const obj of searchResponse.searchResults.objects) {
5150

5251
// START DiversityRanking
5352
const diversitySearchResponse = await qa.search("summer shoes", {
54-
filtering: "recall",
5553
limit: 10,
5654
diversityWeight: 0.5,
5755
collections: [{
@@ -69,7 +67,6 @@ for (const obj of diversitySearchResponse.searchResults.objects) {
6967
// Search with pagination
7068
const responsePage1 = await qa.search(
7169
"Find summer shoes and accessories between $50 and $100 that have the tag 'sale'", {
72-
filtering: "recall",
7370
limit: 3,
7471
});
7572

docs/query-agent/_includes/code/search_mode.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
# START BasicSearchMode
4242
search_response = qa.search(
4343
query="Find me some vintage shoes under $70",
44-
filtering="recall",
4544
limit=10,
4645
)
4746

@@ -63,7 +62,6 @@
6362

6463
search_response = qa.search(
6564
"summer shoes",
66-
filtering="recall",
6765
limit=10,
6866
diversity_weight=0.5,
6967
)
@@ -76,7 +74,6 @@
7674
# Search with pagination
7775
response_page_1 = qa.search(
7876
"Find summer shoes and accessories between $50 and $100 that have the tag 'sale'",
79-
filtering="recall",
8077
limit=3,
8178
)
8279

@@ -138,7 +135,6 @@
138135
# START AsyncSearch
139136
await async_qa.search(
140137
query="Find me some vintage shoes under $70",
141-
filtering="recall",
142138
limit=10,
143139
)
144140
# END AsyncSearch
@@ -165,7 +161,6 @@ async def _async_run_for_testing():
165161

166162
await async_qa.search(
167163
query="Find me some vintage shoes under $70",
168-
filtering="recall",
169164
limit=10,
170165
)
171166
await async_client.close()

docs/query-agent/guides/search_mode.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The `.search()` method accepts several arguments:
6767
| `query` | `str \| list[ChatMessage]` | The user query you want the agent to search with. This can be a simple string (`"Find me some vintage shoes under $70"`) or a list of chat messages (for conversational context). [See the page on multi-turn conversations for more detail](../reference/multi_turn_conversations.md). |
6868
| `collections` | `list[str \| QueryAgentCollectionConfig] \| None` | The name(s) of the collections to search. You can pass one or many collection names as a list of strings (e.g., `["ECommerce", "BookSales"]`), or provide collection configuration objects for more control. If specified in the `ask` method, it will overwrite those defined in the instantiation of `QueryAgent`. [See the page on collection configuration for more detail](../reference/advanced_collections.md). |
6969
| `limit` | `int` | The maximum number of results returned in this page of results. Defaults to `20`. Use [`.next()`](#pagination) to fetch additional pages. |
70-
| `filtering` | `Literal["recall", "precision"]` | **Required.** Either `"recall"` or `"precision"` to control filter generation. `"recall"` favors more results across filter interpretations; `"precision"` favors strict intent match. Pass `"recall"` for most cases. See [Customized filtering](#customized-filtering) below. |
70+
| `filtering` | `Literal["recall", "precision"]` | Either `"recall"` or `"precision"` to control filter generation. `"recall"` favors more results across filter interpretations; `"precision"` favors strict intent match. See [Customized filtering](#customized-filtering) below. |
7171
| `diversity_weight` | `float \| None` | A value between `0.0` and `1.0` that biases the result ranking towards diversity using Maximal Marginal Relevance (MMR). See [Diversity ranking](#diversity-ranking) below. |
7272

7373
</TabItem>
@@ -77,7 +77,7 @@ The `.search()` method accepts several arguments:
7777
| `query` | `string \| ChatMessage[]` | The user query you want the agent to search with. This can be a simple string (`"Find me some vintage shoes under $70"`) or a list of chat messages (for conversational context). [See the page on multi-turn conversations for more detail](../reference/multi_turn_conversations.md). |
7878
| `collections` | `(string \| QueryAgentCollectionConfig)[]` | The name(s) of the collections to search. You can pass one or many collection names as a list of strings (e.g., `["ECommerce", "BookSales"]`), or provide collection configuration objects for more control. If specified in the `ask` method, it will overwrite those defined in the instantiation of `QueryAgent`. [See the page on collection configuration for more detail](../reference/advanced_collections.md). |
7979
| `limit` | `number` | The maximum number of results returned in this page of results. Defaults to `20`. Use [`.next()`](#pagination) to fetch additional pages. |
80-
| `filtering` | `"recall" \| "precision"` | **Required.** Either `"recall"` or `"precision"` to control filter generation. `"recall"` favors more results across filter interpretations; `"precision"` favors strict intent match. Pass `"recall"` for most cases. See [Customized filtering](#customized-filtering) below. |
80+
| `filtering` | `"recall" \| "precision"` | Either `"recall"` or `"precision"` to control filter generation. `"recall"` favors more results across filter interpretations; `"precision"` favors strict intent match. See [Customized filtering](#customized-filtering) below. |
8181
| `diversityWeight` | `number` | A value between `0.0` and `1.0` that biases the result ranking towards diversity using Maximal Marginal Relevance (MMR). See [Diversity ranking](#diversity-ranking) below. |
8282

8383
</TabItem>
@@ -89,9 +89,7 @@ For more advanced searches, you can also specify _additional filters_ within the
8989

9090
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.
9191

92-
`filtering` is a required argument; pass either `"recall"` or `"precision"`. `"recall"` is recommended when you want more results.
93-
94-
- **`"recall"`** (recommended): 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.
92+
- **`"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.
9593

9694
- **`"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.
9795

0 commit comments

Comments
 (0)