Add MRL to Inference docs

This commit is contained in:
Abdon Pijpelink
2025-12-02 17:54:11 +01:00
parent 2eb4cc3d79
commit 4bf27de7b9
5 changed files with 65 additions and 1 deletions
@@ -0,0 +1 @@
This code snippet illustrates how to use smaller vectors for the initial prefetching of candidates from a large collection, followed by re-scoring with the original-sized vectors to improve accuracy, combined with inference. For the smaller vector, it employs Matryoshka Representation Learning (MRL) to reduce the dimensionality of embeddings by specifying the `mrl` parameter in the `options` object.
@@ -0,0 +1,26 @@
```http
POST /collections/{collection_name}/points/query
{
"prefetch": {
"query": {
"text": "How to bake cookies?",
"model": "openai/text-embedding-3-small",
"options": {
"openai-api-key": "<YOUR_OPENAI_API_KEY>",
"mrl": 64
}
},
"using": "small",
"limit": 1000
},
"query": {
"text": "How to bake cookies?",
"model": "openai/text-embedding-3-small",
"options": {
"openai-api-key": "<YOUR_OPENAI_API_KEY>"
}
},
"using": "large",
"limit": 10
}
```
@@ -0,0 +1 @@
This code snippet illustrates how to reduce the dimensionality of embeddings using Matryoshka Representation Learning (MRL) when using inference. It demonstrates how to insert a point into a Qdrant collection with a reduced-size vector by specifying the `mrl` parameter in the `options` object.
@@ -0,0 +1,20 @@
```http
PUT /collections/{collection_name}/points?wait=true
{
"points": [
{
"id": 1,
"vector": {
"small": {
"text": "Recipe for baking chocolate chip cookies",
"model": "openai/text-embedding-3-small",
"options": {
"openai-api-key": "<YOUR_OPENAI_API_KEY>",
"mrl": 64
}
}
}
}
]
}
```