aboutsummaryrefslogtreecommitdiff
path: root/apps/docs/memory-api/features/reranking.mdx
blob: 1df8a9c5fb2a28dd031174c283f6a5b64a29b68d (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
---
title: "Reranking"
description: "Reranked search results in supermemory"
icon: "chart-bar-increasing"
---

Reranking is a feature that allows you to rerank search results based on the query.

![Reranking](/images/rerank.png)

### Usage

In supermemory, you can enable answer rewriting by setting the `rerank` parameter to `true` in the search API.

<CodeGroup>

```bash cURL
curl https://api.supermemory.ai/v3/search?q=What+is+the+capital+of+France?&rerank=true \
  --request GET \
  --header 'Authorization: Bearer SUPERMEMORY_API_KEY'
```

```typescript
await client.search.create({
  q: "What is the capital of France?",
  rerank: true,
});
```

```python
client.search.create(
    q="What is the capital of France?",
    rerank=True
)
```

</CodeGroup>

### Notes and limitations

- We currently use `bge-reranker-base` model for reranking.
- There is no additional costs associated with reranking.
- While reranking makes the quality much better, it also **incurs additional latency**.
- All other features like filtering, hybrid search, recency bias, etc. work with reranked results as well.