Skip to content
Draft
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
11 changes: 11 additions & 0 deletions docs/query-agent/_includes/code/search_mode.mts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,15 @@ for (const obj of filteringResponse.searchResults.objects) {
}
// END FilteringExample

// START EffortExample
const effortResponse = await qa.search("What are Setwise Rerankers?", {
limit: 10,
effort: "high",
});

for (const obj of effortResponse.searchResults.objects) {
console.log(obj.properties);
}
// END EffortExample

await client.close();
11 changes: 11 additions & 0 deletions docs/query-agent/_includes/code/search_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@
print(f"Product: {obj.properties['name']} - ${obj.properties['price']}")
# END FilteringExample

# START EffortExample
search_response = qa.search(
"What are Setwise Rerankers?",
limit=10,
effort="high",
)

for obj in search_response.search_results.objects:
print(obj.properties)
# END EffortExample

# --- Async code examples in string as top-level await doesn't work, full code will be executed in
# asyncio.run below

Expand Down
27 changes: 27 additions & 0 deletions docs/query-agent/guides/search_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ The `.search()` method accepts several arguments:
| `limit` | `int` | The maximum number of results returned in this page of results. Defaults to `20`. Use [`.next()`](#pagination) to fetch additional pages. |
| `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. |
| `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. |
| `effort` | `Literal["low", "medium", "high"] \| None` | The amount of effort the agent puts into the search. Higher effort may improve result quality at the expense of increased latency and cost. See [Search effort](#search-effort) below. |

</TabItem>
<TabItem value="ts_agents" label="JavaScript/TypeScript">
Expand All @@ -79,6 +80,7 @@ The `.search()` method accepts several arguments:
| `limit` | `number` | The maximum number of results returned in this page of results. Defaults to `20`. Use [`.next()`](#pagination) to fetch additional pages. |
| `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. |
| `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. |
| `effort` | `"low" \| "medium" \| "high"` | The amount of effort the agent puts into the search. Higher effort may improve result quality at the expense of increased latency and cost. See [Search effort](#search-effort) below. |

</TabItem>
</Tabs>
Expand Down Expand Up @@ -138,6 +140,31 @@ To use diversity ranking with target vectors, set the single target vector you w
</TabItem>
</Tabs>

### Search effort

The optional `effort` parameter controls the amount of effort the agent puts into the search. It accepts one of `"low"`, `"medium"`, or `"high"` — higher effort may improve result quality at the expense of increased latency and cost. When omitted, the search behaves as if the parameter did not exist.

The effort value is fixed for the lifetime of a search: paginating with [`.next()`](#pagination) reuses the same effort value on every page, just as the underlying searches are reused to keep the result set consistent.

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

## Response
The Search Mode response has the following properties:

Expand Down
Loading