mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
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:
co-authored by
Claude Sonnet 4.6
parent
90d072eb03
commit
478b96554f
+12
-9
@@ -5,21 +5,24 @@ public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
// @hide-start
|
||||
var client = new QdrantClient(
|
||||
host: "xyz-example.qdrant.io",
|
||||
port: 6334,
|
||||
https: true,
|
||||
apiKey: "<your-api-key>"
|
||||
);
|
||||
// @hide-end
|
||||
|
||||
await client.QueryAsync(
|
||||
collectionName: "{collection_name}",
|
||||
query: new Document()
|
||||
{
|
||||
Model = "jinaai/jina-clip-v2",
|
||||
Text = "Mission to Mars",
|
||||
Options = { ["jina-api-key"] = "<YOUR_JINAAI_API_KEY>", ["dimensions"] = 512 },
|
||||
}
|
||||
);
|
||||
using (RequestHeaders.Use("jina-api-key", "<YOUR_JINAAI_API_KEY>"))
|
||||
await client.QueryAsync(
|
||||
collectionName: "{collection_name}",
|
||||
query: new Document()
|
||||
{
|
||||
Model = "jinaai/jina-clip-v2",
|
||||
Text = "Mission to Mars",
|
||||
Options = { ["dimensions"] = 512 },
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-16
@@ -2,20 +2,14 @@
|
||||
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.QueryAsync(
|
||||
collectionName: "{collection_name}",
|
||||
query: new Document()
|
||||
{
|
||||
Model = "jinaai/jina-clip-v2",
|
||||
Text = "Mission to Mars",
|
||||
Options = { ["jina-api-key"] = "<YOUR_JINAAI_API_KEY>", ["dimensions"] = 512 },
|
||||
}
|
||||
);
|
||||
using (RequestHeaders.Use("jina-api-key", "<YOUR_JINAAI_API_KEY>"))
|
||||
await client.QueryAsync(
|
||||
collectionName: "{collection_name}",
|
||||
query: new Document()
|
||||
{
|
||||
Model = "jinaai/jina-clip-v2",
|
||||
Text = "Mission to Mars",
|
||||
Options = { ["dimensions"] = 512 },
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
+3
-9
@@ -5,22 +5,16 @@ 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(), "jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||
|
||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||
client.Query(ctx, &qdrant.QueryPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Query: qdrant.NewQueryNearest(
|
||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||
Text: "Mission to Mars",
|
||||
Model: "jinaai/jina-clip-v2",
|
||||
Options: qdrant.NewValueMap(map[string]any{
|
||||
"jina-api-key": "<YOUR_JINAAI_API_KEY>",
|
||||
"dimensions": 512,
|
||||
"dimensions": 512,
|
||||
}),
|
||||
}),
|
||||
),
|
||||
|
||||
+7
-9
@@ -2,18 +2,18 @@
|
||||
import static io.qdrant.client.QueryFactory.nearest;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
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.QueryPoints;
|
||||
import java.util.Map;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(
|
||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||
.withApiKey("<your-api-key")
|
||||
.build());
|
||||
client
|
||||
Context ctx = RequestHeaders.withHeader(
|
||||
Context.current(), "jina-api-key", "<YOUR_JINAAI_API_KEY>");
|
||||
|
||||
ctx.call(() -> client
|
||||
.queryAsync(
|
||||
QueryPoints.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
@@ -24,11 +24,9 @@ client
|
||||
.setText("Mission to Mars")
|
||||
.putAllOptions(
|
||||
Map.of(
|
||||
"jina-api-key",
|
||||
value("<YOUR_JINAAI_API_KEY>"),
|
||||
"dimensions",
|
||||
value(512)))
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
.get());
|
||||
```
|
||||
|
||||
+12
-11
@@ -1,21 +1,22 @@
|
||||
```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.query_points(
|
||||
collection_name="{collection_name}",
|
||||
query=models.Document(
|
||||
text="Mission to Mars",
|
||||
model="jinaai/jina-clip-v2",
|
||||
options={
|
||||
"jina-api-key": "<your_jinaai_api_key>",
|
||||
"dimensions": 512
|
||||
}
|
||||
with headers({"jina-api-key": "<YOUR_JINAAI_API_KEY>"}):
|
||||
client.query_points(
|
||||
collection_name="{collection_name}",
|
||||
query=models.Document(
|
||||
text="Mission to Mars",
|
||||
model="jinaai/jina-clip-v2",
|
||||
options={
|
||||
"dimensions": 512
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
+1
-3
@@ -5,13 +5,11 @@ use qdrant_client::{
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
let client = Qdrant::from_url("<your-qdrant-url>").build().unwrap();
|
||||
|
||||
let mut options = HashMap::<String, Value>::new();
|
||||
options.insert("jina-api-key".to_string(), "<YOUR_JINAAI_API_KEY>".into());
|
||||
options.insert("dimensions".to_string(), 512.into());
|
||||
|
||||
client
|
||||
.with_header("jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||
.query(
|
||||
QueryPointsBuilder::new("{collection_name}")
|
||||
.query(Query::new_nearest(Document {
|
||||
|
||||
+11
-12
@@ -1,16 +1,15 @@
|
||||
```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.query("{collection_name}", {
|
||||
query: {
|
||||
text: 'Mission to Mars',
|
||||
model: 'jinaai/jina-clip-v2',
|
||||
options: {
|
||||
'jina-api-key': '<your_jinaai_api_key>',
|
||||
dimensions: 512,
|
||||
await withHeaders({ 'jina-api-key': '<YOUR_JINAAI_API_KEY>' }, () =>
|
||||
client.query("{collection_name}", {
|
||||
query: {
|
||||
text: 'Mission to Mars',
|
||||
model: 'jinaai/jina-clip-v2',
|
||||
options: {
|
||||
dimensions: 512,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
@@ -7,24 +7,27 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "xyz-example.qdrant.io",
|
||||
Port: 6334,
|
||||
APIKey: "<paste-your-api-key-here>",
|
||||
UseTLS: true,
|
||||
})
|
||||
// @hide-end
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||
ctx := qdrant.WithHeader(context.Background(), "jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||
|
||||
client.Query(ctx, &qdrant.QueryPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Query: qdrant.NewQueryNearest(
|
||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||
Text: "Mission to Mars",
|
||||
Model: "jinaai/jina-clip-v2",
|
||||
Options: qdrant.NewValueMap(map[string]any{
|
||||
"jina-api-key": "<YOUR_JINAAI_API_KEY>",
|
||||
"dimensions": 512,
|
||||
"dimensions": 512,
|
||||
}),
|
||||
}),
|
||||
),
|
||||
|
||||
+10
-4
@@ -3,20 +3,28 @@ package com.example.snippets_amalgamation;
|
||||
import static io.qdrant.client.QueryFactory.nearest;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
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.QueryPoints;
|
||||
import java.util.Map;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
QdrantClient client =
|
||||
new QdrantClient(
|
||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||
.withApiKey("<your-api-key")
|
||||
.build());
|
||||
client
|
||||
// @hide-end
|
||||
|
||||
Context ctx = RequestHeaders.withHeader(
|
||||
Context.current(), "jina-api-key", "<YOUR_JINAAI_API_KEY>");
|
||||
|
||||
ctx.call(() -> client
|
||||
.queryAsync(
|
||||
QueryPoints.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
@@ -27,12 +35,10 @@ public class Snippet {
|
||||
.setText("Mission to Mars")
|
||||
.putAllOptions(
|
||||
Map.of(
|
||||
"jina-api-key",
|
||||
value("<YOUR_JINAAI_API_KEY>"),
|
||||
"dimensions",
|
||||
value(512)))
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
.get());
|
||||
}
|
||||
}
|
||||
|
||||
+12
-11
@@ -1,19 +1,20 @@
|
||||
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.query_points(
|
||||
collection_name="{collection_name}",
|
||||
query=models.Document(
|
||||
text="Mission to Mars",
|
||||
model="jinaai/jina-clip-v2",
|
||||
options={
|
||||
"jina-api-key": "<your_jinaai_api_key>",
|
||||
"dimensions": 512
|
||||
}
|
||||
with headers({"jina-api-key": "<YOUR_JINAAI_API_KEY>"}):
|
||||
client.query_points(
|
||||
collection_name="{collection_name}",
|
||||
query=models.Document(
|
||||
text="Mission to Mars",
|
||||
model="jinaai/jina-clip-v2",
|
||||
options={
|
||||
"dimensions": 512
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
+2
-2
@@ -5,13 +5,13 @@ use qdrant_client::{
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("<your-qdrant-url>").build().unwrap();
|
||||
let client = Qdrant::from_url("<your-qdrant-url>").build().unwrap(); // @hide
|
||||
|
||||
let mut options = HashMap::<String, Value>::new();
|
||||
options.insert("jina-api-key".to_string(), "<YOUR_JINAAI_API_KEY>".into());
|
||||
options.insert("dimensions".to_string(), 512.into());
|
||||
|
||||
client
|
||||
.with_header("jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||
.query(
|
||||
QueryPointsBuilder::new("{collection_name}")
|
||||
.query(Query::new_nearest(Document {
|
||||
|
||||
+12
-11
@@ -1,14 +1,15 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||
|
||||
client.query("{collection_name}", {
|
||||
query: {
|
||||
text: 'Mission to Mars',
|
||||
model: 'jinaai/jina-clip-v2',
|
||||
options: {
|
||||
'jina-api-key': '<your_jinaai_api_key>',
|
||||
dimensions: 512,
|
||||
await withHeaders({ 'jina-api-key': '<YOUR_JINAAI_API_KEY>' }, () =>
|
||||
client.query("{collection_name}", {
|
||||
query: {
|
||||
text: 'Mission to Mars',
|
||||
model: 'jinaai/jina-clip-v2',
|
||||
options: {
|
||||
dimensions: 512,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user