blob: 9508297a012358f1b0c4a344fd1599e57762b819 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
---
title: "Query Rewriting"
description: "Query Rewriting in supermemory"
icon: "blend"
---
Query Rewriting is a feature that allows you to rewrite queries to make them more accurate.

### Usage
In supermemory, you can enable query rewriting by setting the `rewriteQuery` parameter to `true` in the search API.
<CodeGroup>
```bash cURL
curl https://api.supermemory.ai/v3/search \
--request POST \
--header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
--header 'Content-Type: application/json' \
-d '{
"q": "What is the capital of France?",
"rewriteQuery": true
}'
```
```typescript
await client.search.create({
q: "What is the capital of France?",
rewriteQuery: true,
});
```
```python
client.search.create(
q="What is the capital of France?",
rewriteQuery=True
)
```
</CodeGroup>
### Notes and limitations
- supermemory generates multiple rewrites, and runs the search through all of them.
- The results are then merged and returned to you.
- There is no additional costs associated with query rewriting.
- While query rewriting makes the quality much better, it also **incurs additional latency**.
- All other features like filtering, hybrid search, recency bias, etc. work with rewritten results as well.
|