mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-06 11:28:31 +02:00
new: add python snippets for mrl inference
This commit is contained in:
+32
@@ -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
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
```
|
||||
Reference in New Issue
Block a user