Restructure inference docs (#2225)

* Break Inference page into several pages

* Make all inference code snippets testable and clean up

* Make more snippets testable

* Edits

* Document automatic query and passage prefix injection in Cloud Inference

Qdrant Cloud Inference silently applies model-specific prefixes (e.g.
"query: "/"passage: " for E5, BGE-style instruction prefix for BGE/mxbai/
Snowflake arctic-embed) so users don't need to manage them manually.
Add a section explaining this behavior, the idempotency guarantee, and
the scope (Qdrant-hosted models only; external providers handle their own).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Document short query optimization in Cloud Inference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update links

* Expand on external provider API key usage

* Add section about external provider API keys

* Default to header for external API keys

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Abdon Pijpelink
2026-06-24 08:11:03 +02:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 90d072eb03
commit 478b96554f
250 changed files with 3259 additions and 2187 deletions
@@ -2,23 +2,21 @@
using Qdrant.Client;
using Qdrant.Client.Grpc;
var client = new QdrantClient(
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
await client.UpsertAsync(
collectionName: "{collection_name}",
points: new List<PointStruct>
{
new()
using (RequestHeaders.Use("openai-api-key", "<YOUR_OPENAI_API_KEY>"))
await client.UpsertAsync(
collectionName: "{collection_name}",
points: new List<PointStruct>
{
Id = 1,
Vectors = new Document()
new()
{
Model = "openai/text-embedding-3-large",
Text = "Recipe for baking chocolate chip cookies",
Options = { ["openai-api-key"] = "<YOUR_OPENAI_API_KEY>", ["dimensions"] = 512 },
Id = 1,
Vectors = new Document()
{
Model = "openai/text-embedding-3-large",
Text = "Recipe for baking chocolate chip cookies",
Options = { ["dimensions"] = 512 },
},
},
},
}
);
}
);
```
@@ -5,14 +5,9 @@ import (
"github.com/qdrant/go-client/qdrant"
)
client, err := qdrant.NewClient(&qdrant.Config{
Host: "xyz-example.qdrant.io",
Port: 6334,
APIKey: "<paste-your-api-key-here>",
UseTLS: true,
})
ctx := qdrant.WithHeader(context.Background(), "openai-api-key", "<YOUR_OPENAI_API_KEY>")
client.Upsert(context.Background(), &qdrant.UpsertPoints{
client.Upsert(ctx, &qdrant.UpsertPoints{
CollectionName: "{collection_name}",
Points: []*qdrant.PointStruct{
{
@@ -21,8 +16,7 @@ client.Upsert(context.Background(), &qdrant.UpsertPoints{
Model: "openai/text-embedding-3-large",
Text: "Recipe for baking chocolate chip cookies",
Options: qdrant.NewValueMap(map[string]any{
"openai-api-key": "<YOUR_OPENAI_API_KEY>",
"dimensions": 512,
"dimensions": 512,
}),
}),
},
@@ -3,37 +3,34 @@ import static io.qdrant.client.PointIdFactory.id;
import static io.qdrant.client.ValueFactory.value;
import static io.qdrant.client.VectorsFactory.vectors;
import io.grpc.Context;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.RequestHeaders;
import io.qdrant.client.grpc.Points.Document;
import io.qdrant.client.grpc.Points.PointStruct;
import java.util.List;
import java.util.Map;
QdrantClient client =
new QdrantClient(
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
.withApiKey("<your-api-key")
.build());
Context ctx = RequestHeaders.withHeader(
Context.current(), "openai-api-key", "<YOUR_OPENAI_API_KEY>");
client
.upsertAsync(
"{collection_name}",
List.of(
PointStruct.newBuilder()
.setId(id(1))
.setVectors(
vectors(
Document.newBuilder()
.setModel("openai/text-embedding-3-large")
.setText("Recipe for baking chocolate chip cookies")
.putAllOptions(
Map.of(
"openai-api-key",
value("<YOUR_OPENAI_API_KEY>"),
"dimensions",
value(512)))
.build()))
.build()))
.get();
ctx.call(() -> client
.upsertAsync(
"{collection_name}",
List.of(
PointStruct.newBuilder()
.setId(id(1))
.setVectors(
vectors(
Document.newBuilder()
.setModel("openai/text-embedding-3-large")
.setText("Recipe for baking chocolate chip cookies")
.putAllOptions(
Map.of(
"dimensions",
value(512)))
.build()))
.build()))
.get());
```
@@ -1,26 +1,27 @@
```python
from qdrant_client import QdrantClient, models
from qdrant_client.context_headers import headers
client = QdrantClient(
url="https://xyz-example.qdrant.io:6333",
api_key="<your-api-key>",
api_key="<your-qdrant-api-key>",
cloud_inference=True
)
client.upsert(
collection_name="{collection_name}",
points=[
models.PointStruct(
id=1,
vector=models.Document(
text="Recipe for baking chocolate chip cookies",
model="openai/text-embedding-3-large",
options={
"openai-api-key": "<your_openai_api_key>",
"dimensions": 512
}
with headers({"openai-api-key": "<YOUR_OPENAI_API_KEY>"}):
client.upsert(
collection_name="{collection_name}",
points=[
models.PointStruct(
id=1,
vector=models.Document(
text="Recipe for baking chocolate chip cookies",
model="openai/text-embedding-3-large",
options={
"dimensions": 512
}
)
)
)
]
)
]
)
```
@@ -5,12 +5,11 @@ use qdrant_client::{
};
use std::collections::HashMap;
let client = Qdrant::from_url("<your-qdrant-url>").build()?;
let mut options = HashMap::new();
options.insert("openai-api-key".to_string(), "<YOUR_OPENAI_API_KEY>".into());
options.insert("dimensions".to_string(), 512.into());
client
.with_header("openai-api-key", "<YOUR_OPENAI_API_KEY>")
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
vec![
PointStruct::new(1,
@@ -1,21 +1,20 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
text: 'Recipe for baking chocolate chip cookies',
model: 'openai/text-embedding-3-large',
options: {
'openai-api-key': '<your_openai_api_key>',
dimensions: 512,
await withHeaders({ 'openai-api-key': '<YOUR_OPENAI_API_KEY>' }, () =>
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
text: 'Recipe for baking chocolate chip cookies',
model: 'openai/text-embedding-3-large',
options: {
dimensions: 512,
},
},
},
},
],
});
],
})
);
```