new: add python snippets for mrl inference

This commit is contained in:
George Panchuk
2025-12-05 17:26:57 +07:00
parent 6f07810987
commit f0c91af02f
2 changed files with 65 additions and 0 deletions
@@ -0,0 +1,32 @@
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(
url="https://xyz-example.qdrant.io:6333",
api_key="<your-api-key>",
cloud_inference=True
)
client.query_points(
collection_name="{collection_name}",
query=models.Document(
text="How to bake cookies?",
model="openai/text-embedding-3-small",
options={"openai-api-key": "<YOUR_OPENAI_API_KEY>"}
),
using="large",
limit=10,
prefetch=models.Prefetch(
query=models.Document(
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,
)
)
```
@@ -0,0 +1,33 @@
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(
url="https://xyz-example.qdrant.io:6333",
api_key="<your-api-key>",
cloud_inference=True
)
client.upsert(
collection_name="{collection_name}",
points=[
models.PointStruct(
id=1,
vector={
"large": models.Document(
text="Recipe for baking chocolate chip cookies",
model="openai/text-embedding-3-small",
options={"openai-api-key": "<YOUR_OPENAI_API_KEY"}
),
"small": models.Document(
text="Recipe for baking chocolate chip cookies",
model="openai/text-embedding-3-small",
options={
"openai-api-key": "<YOUR_OPENAI_API_KEY",
"mrl": 64
},
)
},
)
],
)
```