mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 04:48:30 +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
@@ -124,7 +124,7 @@ Additionally, this release adds the following features:
|
|||||||
- Reciprocal Rank Fusion (RRF) combines multiple query results into one list, but its default equal weighting can let weaker rankers dilute stronger ones. [Weighted RRF](/documentation/search/hybrid-queries/#reciprocal-rank-fusion-rrf) in Qdrant 1.17 addresses this by letting you assign weights to individual queries.
|
- Reciprocal Rank Fusion (RRF) combines multiple query results into one list, but its default equal weighting can let weaker rankers dilute stronger ones. [Weighted RRF](/documentation/search/hybrid-queries/#reciprocal-rank-fusion-rrf) in Qdrant 1.17 addresses this by letting you assign weights to individual queries.
|
||||||
- A new [user interface in the Web UI enables resharding collections](https://github.com/qdrant/qdrant-web-ui/pull/341) on Qdrant Cloud.
|
- A new [user interface in the Web UI enables resharding collections](https://github.com/qdrant/qdrant-web-ui/pull/341) on Qdrant Cloud.
|
||||||
- Qdrant now supports [audit logging](/documentation/security/#audit-logging) to track all API operations that require authentication or authorization.
|
- Qdrant now supports [audit logging](/documentation/security/#audit-logging) to track all API operations that require authentication or authorization.
|
||||||
- [External provider API keys for inference requests](/documentation/inference/#external-embedding-model-providers) can now be provided in the request header.
|
- [External provider API keys for inference requests](/documentation/inference/external-inference-providers/) can now be provided in the request header.
|
||||||
|
|
||||||
For a full list of all changes in version 1.17, please refer to the [change log](https://github.com/qdrant/qdrant/releases/tag/v1.17.0).
|
For a full list of all changes in version 1.17, please refer to the [change log](https://github.com/qdrant/qdrant/releases/tag/v1.17.0).
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ public class Snippet
|
|||||||
{
|
{
|
||||||
public static async Task Run()
|
public static async Task Run()
|
||||||
{
|
{
|
||||||
|
// @hide-start
|
||||||
var client = new QdrantClient(
|
var client = new QdrantClient(
|
||||||
host: "xyz-example.qdrant.io",
|
host: "xyz-example.qdrant.io",
|
||||||
port: 6334,
|
port: 6334,
|
||||||
https: true,
|
https: true,
|
||||||
apiKey: "<paste-your-api-key-here>"
|
apiKey: "<paste-your-api-key-here>"
|
||||||
);
|
);
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
await client.UpsertAsync(
|
await client.UpsertAsync(
|
||||||
collectionName: "<your-collection>",
|
collectionName: "<your-collection>",
|
||||||
|
|||||||
-7
@@ -3,13 +3,6 @@ using Qdrant.Client;
|
|||||||
using Qdrant.Client.Grpc;
|
using Qdrant.Client.Grpc;
|
||||||
using Value = Qdrant.Client.Grpc.Value;
|
using Value = Qdrant.Client.Grpc.Value;
|
||||||
|
|
||||||
var client = new QdrantClient(
|
|
||||||
host: "xyz-example.qdrant.io",
|
|
||||||
port: 6334,
|
|
||||||
https: true,
|
|
||||||
apiKey: "<paste-your-api-key-here>"
|
|
||||||
);
|
|
||||||
|
|
||||||
await client.UpsertAsync(
|
await client.UpsertAsync(
|
||||||
collectionName: "<your-collection>",
|
collectionName: "<your-collection>",
|
||||||
points: new List <PointStruct> {
|
points: new List <PointStruct> {
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
```go
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(1),
|
||||||
|
Vectors: qdrant.NewVectorsImage(&qdrant.Image{
|
||||||
|
Model: "qdrant/clip-vit-b-32-vision",
|
||||||
|
Image: qdrant.NewValueString("https://qdrant.tech/example.png"),
|
||||||
|
}),
|
||||||
|
Payload: qdrant.NewValueMap(map[string]any{
|
||||||
|
"title": "Example image",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Query: qdrant.NewQueryNearest(
|
||||||
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
|
Text: "Mission to Mars",
|
||||||
|
Model: "qdrant/clip-vit-b-32-text",
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
```
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
```java
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
import static io.qdrant.client.QueryFactory.nearest;
|
||||||
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.qdrant.client.QdrantClient;
|
||||||
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.grpc.Points;
|
||||||
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
|
import io.qdrant.client.grpc.Points.Image;
|
||||||
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsertAsync(
|
||||||
|
"<your-collection>",
|
||||||
|
List.of(
|
||||||
|
PointStruct.newBuilder()
|
||||||
|
.setId(id(1))
|
||||||
|
.setVectors(
|
||||||
|
vectors(
|
||||||
|
Image.newBuilder()
|
||||||
|
.setImage(value("https://qdrant.tech/example.png"))
|
||||||
|
.setModel("qdrant/clip-vit-b-32-vision")
|
||||||
|
.build()))
|
||||||
|
.putAllPayload(Map.of("title", value("Example Image")))
|
||||||
|
.build()))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
List<Points.ScoredPoint> points =
|
||||||
|
client
|
||||||
|
.queryAsync(
|
||||||
|
Points.QueryPoints.newBuilder()
|
||||||
|
.setCollectionName("<your-collection>")
|
||||||
|
.setQuery(
|
||||||
|
nearest(
|
||||||
|
Document.newBuilder()
|
||||||
|
.setText("Mission to Mars")
|
||||||
|
.setModel("qdrant/clip-vit-b-32-text")
|
||||||
|
.build()))
|
||||||
|
.build())
|
||||||
|
.get();
|
||||||
|
|
||||||
|
System.out.printf(points.toString());
|
||||||
|
```
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
```rust
|
||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, Image, PointStruct, Query, QueryPointsBuilder, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
|
||||||
|
let points = vec![PointStruct::new(
|
||||||
|
1,
|
||||||
|
Image {
|
||||||
|
image: Some("https://qdrant.tech/example.png".into()),
|
||||||
|
model: "qdrant/clip-vit-b-32-vision".into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Payload::try_from(serde_json::json!({
|
||||||
|
"title": "Example Image"
|
||||||
|
}))?,
|
||||||
|
)];
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new("<your-collection>", points).wait(true))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let query_document = Document {
|
||||||
|
text: "Mission to Mars".into(),
|
||||||
|
model: "qdrant/clip-vit-b-32-text".into(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = client
|
||||||
|
.query(
|
||||||
|
QueryPointsBuilder::new("<your-collection>")
|
||||||
|
.query(Query::new_nearest(query_document))
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Result: {:?}", result);
|
||||||
|
```
|
||||||
-5
@@ -1,11 +1,6 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import {QdrantClient} from "@qdrant/js-client-rest";
|
import {QdrantClient} from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({
|
|
||||||
url: 'https://xyz-example.qdrant.io:6333',
|
|
||||||
apiKey: '<paste-your-api-key-here>',
|
|
||||||
});
|
|
||||||
|
|
||||||
const points = [
|
const points = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package snippet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
defer client.Close() // @hide
|
||||||
|
|
||||||
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(1),
|
||||||
|
Vectors: qdrant.NewVectorsImage(&qdrant.Image{
|
||||||
|
Model: "qdrant/clip-vit-b-32-vision",
|
||||||
|
Image: qdrant.NewValueString("https://qdrant.tech/example.png"),
|
||||||
|
}),
|
||||||
|
Payload: qdrant.NewValueMap(map[string]any{
|
||||||
|
"title": "Example image",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Query: qdrant.NewQueryNearest(
|
||||||
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
|
Text: "Mission to Mars",
|
||||||
|
Model: "qdrant/clip-vit-b-32-text",
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
```go
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"log"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/qdrant/go-client/qdrant"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
|
||||||
Host: "xyz-example.qdrant.io",
|
|
||||||
Port: 6334,
|
|
||||||
APIKey: "<paste-your-api-key-here>",
|
|
||||||
UseTLS: true,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("did not connect: %v", err)
|
|
||||||
}
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
_, err = client.Upsert(ctx, &qdrant.UpsertPoints{
|
|
||||||
CollectionName: "<your-collection>",
|
|
||||||
Points: []*qdrant.PointStruct{
|
|
||||||
{
|
|
||||||
Id: qdrant.NewIDNum(1),
|
|
||||||
Vectors: qdrant.NewVectorsImage(&qdrant.Image{
|
|
||||||
Model: "qdrant/clip-vit-b-32-vision",
|
|
||||||
Image: qdrant.NewValueString("https://qdrant.tech/example.png"),
|
|
||||||
}),
|
|
||||||
Payload: qdrant.NewValueMap(map[string]any{
|
|
||||||
"title": "Example image",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("error creating point: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
points, err := client.Query(ctx, &qdrant.QueryPoints{
|
|
||||||
CollectionName: "<your-collection>",
|
|
||||||
Query: qdrant.NewQueryNearest(
|
|
||||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
|
||||||
Text: "Mission to Mars",
|
|
||||||
Model: "qdrant/clip-vit-b-32-text",
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
log.Printf("List of points: %s", points)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
package com.example.snippets_amalgamation;
|
||||||
|
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
import static io.qdrant.client.QueryFactory.nearest;
|
||||||
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.qdrant.client.QdrantClient;
|
||||||
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.grpc.Points;
|
||||||
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
|
import io.qdrant.client.grpc.Points.Image;
|
||||||
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
|
import java.util.List;
|
||||||
|
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("<paste-your-api-key-here>")
|
||||||
|
.build());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsertAsync(
|
||||||
|
"<your-collection>",
|
||||||
|
List.of(
|
||||||
|
PointStruct.newBuilder()
|
||||||
|
.setId(id(1))
|
||||||
|
.setVectors(
|
||||||
|
vectors(
|
||||||
|
Image.newBuilder()
|
||||||
|
.setImage(value("https://qdrant.tech/example.png"))
|
||||||
|
.setModel("qdrant/clip-vit-b-32-vision")
|
||||||
|
.build()))
|
||||||
|
.putAllPayload(Map.of("title", value("Example Image")))
|
||||||
|
.build()))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
List<Points.ScoredPoint> points =
|
||||||
|
client
|
||||||
|
.queryAsync(
|
||||||
|
Points.QueryPoints.newBuilder()
|
||||||
|
.setCollectionName("<your-collection>")
|
||||||
|
.setQuery(
|
||||||
|
nearest(
|
||||||
|
Document.newBuilder()
|
||||||
|
.setText("Mission to Mars")
|
||||||
|
.setModel("qdrant/clip-vit-b-32-text")
|
||||||
|
.build()))
|
||||||
|
.build())
|
||||||
|
.get();
|
||||||
|
|
||||||
|
System.out.printf(points.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
```java
|
|
||||||
package org.example;
|
|
||||||
|
|
||||||
import static io.qdrant.client.PointIdFactory.id;
|
|
||||||
import static io.qdrant.client.QueryFactory.nearest;
|
|
||||||
import static io.qdrant.client.ValueFactory.value;
|
|
||||||
import static io.qdrant.client.VectorsFactory.vectors;
|
|
||||||
|
|
||||||
import io.qdrant.client.grpc.Points;
|
|
||||||
import io.qdrant.client.grpc.Points.Document;
|
|
||||||
import io.qdrant.client.grpc.Points.Image;
|
|
||||||
import io.qdrant.client.grpc.Points.PointStruct;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args)
|
|
||||||
throws ExecutionException, InterruptedException {
|
|
||||||
QdrantClient client =
|
|
||||||
new QdrantClient(
|
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
|
||||||
.withApiKey("<paste-your-api-key-here>")
|
|
||||||
.build());
|
|
||||||
|
|
||||||
client
|
|
||||||
.upsertAsync(
|
|
||||||
"<your-collection>",
|
|
||||||
List.of(
|
|
||||||
PointStruct.newBuilder()
|
|
||||||
.setId(id(1))
|
|
||||||
.setVectors(
|
|
||||||
vectors(
|
|
||||||
Image.newBuilder()
|
|
||||||
.setImage(value("https://qdrant.tech/example.png"))
|
|
||||||
.setModel("qdrant/clip-vit-b-32-vision")
|
|
||||||
.build()))
|
|
||||||
.putAllPayload(Map.of("title", value("Example Image")))
|
|
||||||
.build()))
|
|
||||||
.get();
|
|
||||||
|
|
||||||
List <Points.ScoredPoint> points =
|
|
||||||
client
|
|
||||||
.queryAsync(
|
|
||||||
Points.QueryPoints.newBuilder()
|
|
||||||
.setCollectionName("<your-collection>")
|
|
||||||
.setQuery(
|
|
||||||
nearest(
|
|
||||||
Document.newBuilder()
|
|
||||||
.setText("Mission to Mars")
|
|
||||||
.setModel("qdrant/clip-vit-b-32-text")
|
|
||||||
.build()))
|
|
||||||
.build())
|
|
||||||
.get();
|
|
||||||
|
|
||||||
System.out.printf(points.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
```rust
|
|
||||||
use qdrant_client::qdrant::Query;
|
|
||||||
use qdrant_client::qdrant::QueryPointsBuilder;
|
|
||||||
use qdrant_client::Payload;
|
|
||||||
use qdrant_client::Qdrant;
|
|
||||||
use qdrant_client::qdrant::{Document, Image};
|
|
||||||
use qdrant_client::qdrant::{PointStruct, UpsertPointsBuilder};
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() {
|
|
||||||
let client = Qdrant::from_url("https://xyz-example.qdrant.io:6334")
|
|
||||||
.api_key("<paste-your-api-key-here>")
|
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let points = vec![
|
|
||||||
PointStruct::new(
|
|
||||||
1,
|
|
||||||
Image::new_from_url(
|
|
||||||
"https://qdrant.tech/example.png",
|
|
||||||
"qdrant/clip-vit-b-32-vision"
|
|
||||||
),
|
|
||||||
Payload::try_from(serde_json::json!({
|
|
||||||
"title": "Example Image"
|
|
||||||
})).unwrap(),
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
let upsert_request = UpsertPointsBuilder::new(
|
|
||||||
"<your-collection>",
|
|
||||||
points
|
|
||||||
).wait(true);
|
|
||||||
|
|
||||||
let _ = client.upsert_points(upsert_request).await;
|
|
||||||
|
|
||||||
let query_document = Document::new(
|
|
||||||
"Mission to Mars",
|
|
||||||
"qdrant/clip-vit-b-32-text"
|
|
||||||
);
|
|
||||||
|
|
||||||
let query_request = QueryPointsBuilder::new("<your-collection>")
|
|
||||||
.query(Query::new_nearest(query_document));
|
|
||||||
|
|
||||||
let result = client.query(query_request).await.unwrap();
|
|
||||||
println!("Result: {:?}", result);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, Image, PointStruct, Query, QueryPointsBuilder, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
|
// @hide-start
|
||||||
|
let client = Qdrant::from_url("https://xyz-example.qdrant.io:6334")
|
||||||
|
.api_key("<paste-your-api-key-here>")
|
||||||
|
.build()?;
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
|
let points = vec![PointStruct::new(
|
||||||
|
1,
|
||||||
|
Image {
|
||||||
|
image: Some("https://qdrant.tech/example.png".into()),
|
||||||
|
model: "qdrant/clip-vit-b-32-vision".into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Payload::try_from(serde_json::json!({
|
||||||
|
"title": "Example Image"
|
||||||
|
}))?,
|
||||||
|
)];
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new("<your-collection>", points).wait(true))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let query_document = Document {
|
||||||
|
text: "Mission to Mars".into(),
|
||||||
|
model: "qdrant/clip-vit-b-32-text".into(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = client
|
||||||
|
.query(
|
||||||
|
QueryPointsBuilder::new("<your-collection>")
|
||||||
|
.query(Query::new_nearest(query_document))
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Result: {:?}", result);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
+2
@@ -1,9 +1,11 @@
|
|||||||
import {QdrantClient} from "@qdrant/js-client-rest";
|
import {QdrantClient} from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
|
// @hide-start
|
||||||
const client = new QdrantClient({
|
const client = new QdrantClient({
|
||||||
url: 'https://xyz-example.qdrant.io:6333',
|
url: 'https://xyz-example.qdrant.io:6333',
|
||||||
apiKey: '<paste-your-api-key-here>',
|
apiKey: '<paste-your-api-key-here>',
|
||||||
});
|
});
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
const points = [
|
const points = [
|
||||||
{
|
{
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
```go
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(1),
|
||||||
|
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
||||||
|
Text: "Recipe for baking chocolate chip cookies",
|
||||||
|
Model: "<the-model-to-use>",
|
||||||
|
}),
|
||||||
|
Payload: qdrant.NewValueMap(map[string]any{
|
||||||
|
"topic": "cooking",
|
||||||
|
"type": "dessert",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Query: qdrant.NewQueryNearest(
|
||||||
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
|
Text: "How to bake cookies?",
|
||||||
|
Model: "<the-model-to-use>",
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
```
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
```java
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
import static io.qdrant.client.QueryFactory.nearest;
|
||||||
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.qdrant.client.QdrantClient;
|
||||||
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.grpc.Points;
|
||||||
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsertAsync(
|
||||||
|
"<your-collection>",
|
||||||
|
List.of(
|
||||||
|
PointStruct.newBuilder()
|
||||||
|
.setId(id(1))
|
||||||
|
.setVectors(
|
||||||
|
vectors(
|
||||||
|
Document.newBuilder()
|
||||||
|
.setText("Recipe for baking chocolate chip cookies")
|
||||||
|
.setModel("<the-model-to-use>")
|
||||||
|
.build()))
|
||||||
|
.putAllPayload(Map.of("topic", value("cooking"), "type", value("dessert")))
|
||||||
|
.build()))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
List<Points.ScoredPoint> points =
|
||||||
|
client
|
||||||
|
.queryAsync(
|
||||||
|
Points.QueryPoints.newBuilder()
|
||||||
|
.setCollectionName("<your-collection>")
|
||||||
|
.setQuery(
|
||||||
|
nearest(
|
||||||
|
Document.newBuilder()
|
||||||
|
.setText("How to bake cookies?")
|
||||||
|
.setModel("<the-model-to-use>")
|
||||||
|
.build()))
|
||||||
|
.build())
|
||||||
|
.get();
|
||||||
|
|
||||||
|
System.out.printf(points.toString());
|
||||||
|
```
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
```rust
|
||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, PointStruct, Query, QueryPointsBuilder, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
|
||||||
|
let points = vec![PointStruct::new(
|
||||||
|
1,
|
||||||
|
Document {
|
||||||
|
text: "Recipe for baking chocolate chip cookies".into(),
|
||||||
|
model: "<the-model-to-use>".into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Payload::try_from(serde_json::json!(
|
||||||
|
{"topic": "cooking", "type": "dessert"}
|
||||||
|
))?,
|
||||||
|
)];
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new("<your-collection>", points).wait(true))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let query_document = Document {
|
||||||
|
text: "How to bake cookies?".into(),
|
||||||
|
model: "<the-model-to-use>".into(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = client
|
||||||
|
.query(
|
||||||
|
QueryPointsBuilder::new("<your-collection>")
|
||||||
|
.query(Query::new_nearest(query_document))
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Result: {:?}", result);
|
||||||
|
```
|
||||||
-5
@@ -1,11 +1,6 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import {QdrantClient} from "@qdrant/js-client-rest";
|
import {QdrantClient} from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({
|
|
||||||
url: 'https://xyz-example.qdrant.io:6333',
|
|
||||||
apiKey: '<paste-your-api-key-here>',
|
|
||||||
});
|
|
||||||
|
|
||||||
const points = [
|
const points = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package snippet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
defer client.Close() // @hide
|
||||||
|
|
||||||
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(1),
|
||||||
|
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
||||||
|
Text: "Recipe for baking chocolate chip cookies",
|
||||||
|
Model: "<the-model-to-use>",
|
||||||
|
}),
|
||||||
|
Payload: qdrant.NewValueMap(map[string]any{
|
||||||
|
"topic": "cooking",
|
||||||
|
"type": "dessert",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||||
|
CollectionName: "<your-collection>",
|
||||||
|
Query: qdrant.NewQueryNearest(
|
||||||
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
|
Text: "How to bake cookies?",
|
||||||
|
Model: "<the-model-to-use>",
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
```go
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"log"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/qdrant/go-client/qdrant"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
|
||||||
Host: "xyz-example.qdrant.io",
|
|
||||||
Port: 6334,
|
|
||||||
APIKey: "<paste-your-api-key-here>",
|
|
||||||
UseTLS: true,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("did not connect: %v", err)
|
|
||||||
}
|
|
||||||
defer client.Close()
|
|
||||||
|
|
||||||
_, err = client.Upsert(ctx, &qdrant.UpsertPoints{
|
|
||||||
CollectionName: "<your-collection>",
|
|
||||||
Points: []*qdrant.PointStruct{
|
|
||||||
{
|
|
||||||
Id: qdrant.NewIDNum(1),
|
|
||||||
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
|
||||||
Text: "Recipe for baking chocolate chip cookies",
|
|
||||||
Model: "<the-model-to-use>",
|
|
||||||
}),
|
|
||||||
Payload: qdrant.NewValueMap(map[string]any{
|
|
||||||
"topic": "cooking",
|
|
||||||
"type": "dessert",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("error creating point: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
points, err := client.Query(ctx, &qdrant.QueryPoints{
|
|
||||||
CollectionName: "<your-collection>",
|
|
||||||
Query: qdrant.NewQueryNearest(
|
|
||||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
|
||||||
Text: "How to bake cookies?",
|
|
||||||
Model: "<the-model-to-use>",
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
log.Printf("List of points: %s", points)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package com.example.snippets_amalgamation;
|
||||||
|
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
import static io.qdrant.client.QueryFactory.nearest;
|
||||||
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.qdrant.client.QdrantClient;
|
||||||
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.grpc.Points;
|
||||||
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
|
import java.util.List;
|
||||||
|
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("<paste-your-api-key-here>")
|
||||||
|
.build());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsertAsync(
|
||||||
|
"<your-collection>",
|
||||||
|
List.of(
|
||||||
|
PointStruct.newBuilder()
|
||||||
|
.setId(id(1))
|
||||||
|
.setVectors(
|
||||||
|
vectors(
|
||||||
|
Document.newBuilder()
|
||||||
|
.setText("Recipe for baking chocolate chip cookies")
|
||||||
|
.setModel("<the-model-to-use>")
|
||||||
|
.build()))
|
||||||
|
.putAllPayload(Map.of("topic", value("cooking"), "type", value("dessert")))
|
||||||
|
.build()))
|
||||||
|
.get();
|
||||||
|
|
||||||
|
List<Points.ScoredPoint> points =
|
||||||
|
client
|
||||||
|
.queryAsync(
|
||||||
|
Points.QueryPoints.newBuilder()
|
||||||
|
.setCollectionName("<your-collection>")
|
||||||
|
.setQuery(
|
||||||
|
nearest(
|
||||||
|
Document.newBuilder()
|
||||||
|
.setText("How to bake cookies?")
|
||||||
|
.setModel("<the-model-to-use>")
|
||||||
|
.build()))
|
||||||
|
.build())
|
||||||
|
.get();
|
||||||
|
|
||||||
|
System.out.printf(points.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
```java
|
|
||||||
package org.example;
|
|
||||||
|
|
||||||
import static io.qdrant.client.PointIdFactory.id;
|
|
||||||
import static io.qdrant.client.QueryFactory.nearest;
|
|
||||||
import static io.qdrant.client.ValueFactory.value;
|
|
||||||
import static io.qdrant.client.VectorsFactory.vectors;
|
|
||||||
|
|
||||||
import io.qdrant.client.grpc.Points;
|
|
||||||
import io.qdrant.client.grpc.Points.Document;
|
|
||||||
import io.qdrant.client.grpc.Points.PointStruct;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args)
|
|
||||||
throws ExecutionException, InterruptedException {
|
|
||||||
QdrantClient client =
|
|
||||||
new QdrantClient(
|
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
|
||||||
.withApiKey("<paste-your-api-key-here>")
|
|
||||||
.build());
|
|
||||||
|
|
||||||
client
|
|
||||||
.upsertAsync(
|
|
||||||
"<your-collection>",
|
|
||||||
List.of(
|
|
||||||
PointStruct.newBuilder()
|
|
||||||
.setId(id(1))
|
|
||||||
.setVectors(
|
|
||||||
vectors(
|
|
||||||
Document.newBuilder()
|
|
||||||
.setText("Recipe for baking chocolate chip cookies")
|
|
||||||
.setModel("<the-model-to-use>")
|
|
||||||
.build()))
|
|
||||||
.putAllPayload(Map.of("topic", value("cooking"), "type", value("dessert")))
|
|
||||||
.build()))
|
|
||||||
.get();
|
|
||||||
|
|
||||||
List <Points.ScoredPoint> points =
|
|
||||||
client
|
|
||||||
.queryAsync(
|
|
||||||
Points.QueryPoints.newBuilder()
|
|
||||||
.setCollectionName("<your-collection>")
|
|
||||||
.setQuery(
|
|
||||||
nearest(
|
|
||||||
Document.newBuilder()
|
|
||||||
.setText("How to bake cookies?")
|
|
||||||
.setModel("<the-model-to-use>")
|
|
||||||
.build()))
|
|
||||||
.build())
|
|
||||||
.get();
|
|
||||||
|
|
||||||
System.out.printf(points.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
```rust
|
|
||||||
use qdrant_client::qdrant::Query;
|
|
||||||
use qdrant_client::qdrant::QueryPointsBuilder;
|
|
||||||
use qdrant_client::Payload;
|
|
||||||
use qdrant_client::Qdrant;
|
|
||||||
use qdrant_client::qdrant::{Document};
|
|
||||||
use qdrant_client::qdrant::{PointStruct, UpsertPointsBuilder};
|
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() {
|
|
||||||
let client = Qdrant::from_url("https://xyz-example.qdrant.io:6334")
|
|
||||||
.api_key("<paste-your-api-key-here>")
|
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let points = vec![
|
|
||||||
PointStruct::new(
|
|
||||||
1,
|
|
||||||
Document::new(
|
|
||||||
"Recipe for baking chocolate chip cookies",
|
|
||||||
"<the-model-to-use>"
|
|
||||||
),
|
|
||||||
Payload::try_from(serde_json::json!(
|
|
||||||
{"topic": "cooking", "type": "dessert"}
|
|
||||||
)).unwrap(),
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
let upsert_request = UpsertPointsBuilder::new(
|
|
||||||
"<your-collection>",
|
|
||||||
points
|
|
||||||
).wait(true);
|
|
||||||
|
|
||||||
let _ = client.upsert_points(upsert_request).await;
|
|
||||||
|
|
||||||
let query_document = Document::new(
|
|
||||||
"How to bake cookies?",
|
|
||||||
"<the-model-to-use>"
|
|
||||||
);
|
|
||||||
|
|
||||||
let query_request = QueryPointsBuilder::new("<your-collection>")
|
|
||||||
.query(Query::new_nearest(query_document));
|
|
||||||
|
|
||||||
let result = client.query(query_request).await.unwrap();
|
|
||||||
println!("Result: {:?}", result);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, PointStruct, Query, QueryPointsBuilder, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
|
// @hide-start
|
||||||
|
let client = Qdrant::from_url("https://xyz-example.qdrant.io:6334")
|
||||||
|
.api_key("<paste-your-api-key-here>")
|
||||||
|
.build()?;
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
|
let points = vec![PointStruct::new(
|
||||||
|
1,
|
||||||
|
Document {
|
||||||
|
text: "Recipe for baking chocolate chip cookies".into(),
|
||||||
|
model: "<the-model-to-use>".into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Payload::try_from(serde_json::json!(
|
||||||
|
{"topic": "cooking", "type": "dessert"}
|
||||||
|
))?,
|
||||||
|
)];
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new("<your-collection>", points).wait(true))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let query_document = Document {
|
||||||
|
text: "How to bake cookies?".into(),
|
||||||
|
model: "<the-model-to-use>".into(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let result = client
|
||||||
|
.query(
|
||||||
|
QueryPointsBuilder::new("<your-collection>")
|
||||||
|
.query(Query::new_nearest(query_document))
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Result: {:?}", result);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
+2
-1
@@ -1,10 +1,11 @@
|
|||||||
import {QdrantClient} from "@qdrant/js-client-rest";
|
import {QdrantClient} from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
|
// @hide-start
|
||||||
const client = new QdrantClient({
|
const client = new QdrantClient({
|
||||||
url: 'https://xyz-example.qdrant.io:6333',
|
url: 'https://xyz-example.qdrant.io:6333',
|
||||||
apiKey: '<paste-your-api-key-here>',
|
apiKey: '<paste-your-api-key-here>',
|
||||||
});
|
});
|
||||||
|
// @hide-end
|
||||||
const points = [
|
const points = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|||||||
+12
-9
@@ -5,21 +5,24 @@ public class Snippet
|
|||||||
{
|
{
|
||||||
public static async Task Run()
|
public static async Task Run()
|
||||||
{
|
{
|
||||||
|
// @hide-start
|
||||||
var client = new QdrantClient(
|
var client = new QdrantClient(
|
||||||
host: "xyz-example.qdrant.io",
|
host: "xyz-example.qdrant.io",
|
||||||
port: 6334,
|
port: 6334,
|
||||||
https: true,
|
https: true,
|
||||||
apiKey: "<your-api-key>"
|
apiKey: "<your-api-key>"
|
||||||
);
|
);
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
await client.QueryAsync(
|
using (RequestHeaders.Use("cohere-api-key", "<YOUR_COHERE_API_KEY>"))
|
||||||
collectionName: "{collection_name}",
|
await client.QueryAsync(
|
||||||
query: new Document()
|
collectionName: "{collection_name}",
|
||||||
{
|
query: new Document()
|
||||||
Model = "cohere/embed-v4.0",
|
{
|
||||||
Text = "a green square",
|
Model = "cohere/embed-v4.0",
|
||||||
Options = { ["cohere-api-key"] = "<YOUR_COHERE_API_KEY>", ["output_dimension"] = 512 },
|
Text = "a green square",
|
||||||
}
|
Options = { ["output_dimension"] = 512 },
|
||||||
);
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-16
@@ -2,20 +2,14 @@
|
|||||||
using Qdrant.Client;
|
using Qdrant.Client;
|
||||||
using Qdrant.Client.Grpc;
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
var client = new QdrantClient(
|
using (RequestHeaders.Use("cohere-api-key", "<YOUR_COHERE_API_KEY>"))
|
||||||
host: "xyz-example.qdrant.io",
|
await client.QueryAsync(
|
||||||
port: 6334,
|
collectionName: "{collection_name}",
|
||||||
https: true,
|
query: new Document()
|
||||||
apiKey: "<your-api-key>"
|
{
|
||||||
);
|
Model = "cohere/embed-v4.0",
|
||||||
|
Text = "a green square",
|
||||||
await client.QueryAsync(
|
Options = { ["output_dimension"] = 512 },
|
||||||
collectionName: "{collection_name}",
|
}
|
||||||
query: new Document()
|
);
|
||||||
{
|
|
||||||
Model = "cohere/embed-v4.0",
|
|
||||||
Text = "a green square",
|
|
||||||
Options = { ["cohere-api-key"] = "<YOUR_COHERE_API_KEY>", ["output_dimension"] = 512 },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
|||||||
+2
-8
@@ -5,21 +5,15 @@ import (
|
|||||||
"github.com/qdrant/go-client/qdrant"
|
"github.com/qdrant/go-client/qdrant"
|
||||||
)
|
)
|
||||||
|
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
ctx := qdrant.WithHeader(context.Background(), "cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
Host: "xyz-example.qdrant.io",
|
|
||||||
Port: 6334,
|
|
||||||
APIKey: "<paste-your-api-key-here>",
|
|
||||||
UseTLS: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
client.Query(ctx, &qdrant.QueryPoints{
|
||||||
CollectionName: "{collection_name}",
|
CollectionName: "{collection_name}",
|
||||||
Query: qdrant.NewQueryNearest(
|
Query: qdrant.NewQueryNearest(
|
||||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
Text: "a green square",
|
Text: "a green square",
|
||||||
Model: "cohere/embed-v4.0",
|
Model: "cohere/embed-v4.0",
|
||||||
Options: qdrant.NewValueMap(map[string]any{
|
Options: qdrant.NewValueMap(map[string]any{
|
||||||
"cohere-api-key": "<YOUR_COHERE_API_KEY>",
|
|
||||||
"output_dimension": 512,
|
"output_dimension": 512,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
+20
-23
@@ -2,34 +2,31 @@
|
|||||||
import static io.qdrant.client.QueryFactory.nearest;
|
import static io.qdrant.client.QueryFactory.nearest;
|
||||||
import static io.qdrant.client.ValueFactory.value;
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
|
||||||
|
import io.grpc.Context;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.QdrantGrpcClient;
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.RequestHeaders;
|
||||||
import io.qdrant.client.grpc.Points.Document;
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
import io.qdrant.client.grpc.Points.QueryPoints;
|
import io.qdrant.client.grpc.Points.QueryPoints;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
QdrantClient client =
|
Context ctx = RequestHeaders.withHeader(
|
||||||
new QdrantClient(
|
Context.current(), "cohere-api-key", "<YOUR_COHERE_API_KEY>");
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
|
||||||
.withApiKey("<your-api-key")
|
|
||||||
.build());
|
|
||||||
|
|
||||||
client
|
ctx.call(() -> client
|
||||||
.queryAsync(
|
.queryAsync(
|
||||||
QueryPoints.newBuilder()
|
QueryPoints.newBuilder()
|
||||||
.setCollectionName("{collection_name}")
|
.setCollectionName("{collection_name}")
|
||||||
.setQuery(
|
.setQuery(
|
||||||
nearest(
|
nearest(
|
||||||
Document.newBuilder()
|
Document.newBuilder()
|
||||||
.setModel("cohere/embed-v4.0")
|
.setModel("cohere/embed-v4.0")
|
||||||
.setText("a green square")
|
.setText("a green square")
|
||||||
.putAllOptions(
|
.putAllOptions(
|
||||||
Map.of(
|
Map.of(
|
||||||
"cohere-api-key",
|
"output_dimension",
|
||||||
value("<YOUR_COHERE_API_KEY>"),
|
value(512)))
|
||||||
"output_dimension",
|
.build()))
|
||||||
value(512)))
|
.build())
|
||||||
.build()))
|
.get());
|
||||||
.build())
|
|
||||||
.get();
|
|
||||||
```
|
```
|
||||||
|
|||||||
+12
-11
@@ -1,21 +1,22 @@
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
from qdrant_client.context_headers import headers
|
||||||
|
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
|
||||||
client.query_points(
|
with headers({"cohere-api-key": "<YOUR_COHERE_API_KEY>"}):
|
||||||
collection_name="{collection_name}",
|
client.query_points(
|
||||||
query=models.Document(
|
collection_name="{collection_name}",
|
||||||
text="a green square",
|
query=models.Document(
|
||||||
model="cohere/embed-v4.0",
|
text="a green square",
|
||||||
options={
|
model="cohere/embed-v4.0",
|
||||||
"cohere-api-key": "<your_cohere_api_key>",
|
options={
|
||||||
"output_dimension": 512
|
"output_dimension": 512
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|||||||
+1
-3
@@ -5,13 +5,11 @@ use qdrant_client::{
|
|||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
let client = Qdrant::from_url("http://localhost:6333").build().unwrap();
|
|
||||||
|
|
||||||
let mut options = HashMap::<String, Value>::new();
|
let mut options = HashMap::<String, Value>::new();
|
||||||
options.insert("cohere-api-key".to_string(), "<YOUR_COHERE_API_KEY>".into());
|
|
||||||
options.insert("output_dimension".to_string(), 512.into());
|
options.insert("output_dimension".to_string(), 512.into());
|
||||||
|
|
||||||
client
|
client
|
||||||
|
.with_header("cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
.query(
|
.query(
|
||||||
QueryPointsBuilder::new("{collection_name}")
|
QueryPointsBuilder::new("{collection_name}")
|
||||||
.query(Query::new_nearest(Document {
|
.query(Query::new_nearest(Document {
|
||||||
|
|||||||
+11
-12
@@ -1,16 +1,15 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
await withHeaders({ 'cohere-api-key': '<YOUR_COHERE_API_KEY>' }, () =>
|
||||||
|
client.query("{collection_name}", {
|
||||||
client.query("{collection_name}", {
|
query: {
|
||||||
query: {
|
text: 'a green square',
|
||||||
text: 'a green square',
|
model: 'cohere/embed-v4.0',
|
||||||
model: 'cohere/embed-v4.0',
|
options: {
|
||||||
options: {
|
output_dimension: 512,
|
||||||
'cohere-api-key': '<your_cohere_api_key>',
|
},
|
||||||
output_dimension: 512,
|
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
});
|
);
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -7,23 +7,26 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
|
// @hide-start
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
client, err := qdrant.NewClient(&qdrant.Config{
|
||||||
Host: "xyz-example.qdrant.io",
|
Host: "xyz-example.qdrant.io",
|
||||||
Port: 6334,
|
Port: 6334,
|
||||||
APIKey: "<paste-your-api-key-here>",
|
APIKey: "<paste-your-api-key-here>",
|
||||||
UseTLS: true,
|
UseTLS: true,
|
||||||
})
|
})
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
if err != nil { panic(err) } // @hide
|
if err != nil { panic(err) } // @hide
|
||||||
|
|
||||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
ctx := qdrant.WithHeader(context.Background(), "cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
|
|
||||||
|
client.Query(ctx, &qdrant.QueryPoints{
|
||||||
CollectionName: "{collection_name}",
|
CollectionName: "{collection_name}",
|
||||||
Query: qdrant.NewQueryNearest(
|
Query: qdrant.NewQueryNearest(
|
||||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
Text: "a green square",
|
Text: "a green square",
|
||||||
Model: "cohere/embed-v4.0",
|
Model: "cohere/embed-v4.0",
|
||||||
Options: qdrant.NewValueMap(map[string]any{
|
Options: qdrant.NewValueMap(map[string]any{
|
||||||
"cohere-api-key": "<YOUR_COHERE_API_KEY>",
|
|
||||||
"output_dimension": 512,
|
"output_dimension": 512,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
+9
-4
@@ -3,21 +3,28 @@ package com.example.snippets_amalgamation;
|
|||||||
import static io.qdrant.client.QueryFactory.nearest;
|
import static io.qdrant.client.QueryFactory.nearest;
|
||||||
import static io.qdrant.client.ValueFactory.value;
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
|
||||||
|
import io.grpc.Context;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.QdrantGrpcClient;
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.RequestHeaders;
|
||||||
import io.qdrant.client.grpc.Points.Document;
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
import io.qdrant.client.grpc.Points.QueryPoints;
|
import io.qdrant.client.grpc.Points.QueryPoints;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Snippet {
|
public class Snippet {
|
||||||
public static void run() throws Exception {
|
public static void run() throws Exception {
|
||||||
|
// @hide-start
|
||||||
QdrantClient client =
|
QdrantClient client =
|
||||||
new QdrantClient(
|
new QdrantClient(
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||||
.withApiKey("<your-api-key")
|
.withApiKey("<your-api-key")
|
||||||
.build());
|
.build());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
client
|
Context ctx = RequestHeaders.withHeader(
|
||||||
|
Context.current(), "cohere-api-key", "<YOUR_COHERE_API_KEY>");
|
||||||
|
|
||||||
|
ctx.call(() -> client
|
||||||
.queryAsync(
|
.queryAsync(
|
||||||
QueryPoints.newBuilder()
|
QueryPoints.newBuilder()
|
||||||
.setCollectionName("{collection_name}")
|
.setCollectionName("{collection_name}")
|
||||||
@@ -28,12 +35,10 @@ public class Snippet {
|
|||||||
.setText("a green square")
|
.setText("a green square")
|
||||||
.putAllOptions(
|
.putAllOptions(
|
||||||
Map.of(
|
Map.of(
|
||||||
"cohere-api-key",
|
|
||||||
value("<YOUR_COHERE_API_KEY>"),
|
|
||||||
"output_dimension",
|
"output_dimension",
|
||||||
value(512)))
|
value(512)))
|
||||||
.build()))
|
.build()))
|
||||||
.build())
|
.build())
|
||||||
.get();
|
.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-11
@@ -1,19 +1,20 @@
|
|||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
from qdrant_client.context_headers import headers
|
||||||
|
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
|
||||||
client.query_points(
|
with headers({"cohere-api-key": "<YOUR_COHERE_API_KEY>"}):
|
||||||
collection_name="{collection_name}",
|
client.query_points(
|
||||||
query=models.Document(
|
collection_name="{collection_name}",
|
||||||
text="a green square",
|
query=models.Document(
|
||||||
model="cohere/embed-v4.0",
|
text="a green square",
|
||||||
options={
|
model="cohere/embed-v4.0",
|
||||||
"cohere-api-key": "<your_cohere_api_key>",
|
options={
|
||||||
"output_dimension": 512
|
"output_dimension": 512
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|||||||
+2
-2
@@ -5,13 +5,13 @@ use qdrant_client::{
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub async fn main() -> anyhow::Result<()> {
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
let client = Qdrant::from_url("http://localhost:6333").build().unwrap();
|
let client = Qdrant::from_url("http://localhost:6333").build().unwrap(); // @hide
|
||||||
|
|
||||||
let mut options = HashMap::<String, Value>::new();
|
let mut options = HashMap::<String, Value>::new();
|
||||||
options.insert("cohere-api-key".to_string(), "<YOUR_COHERE_API_KEY>".into());
|
|
||||||
options.insert("output_dimension".to_string(), 512.into());
|
options.insert("output_dimension".to_string(), 512.into());
|
||||||
|
|
||||||
client
|
client
|
||||||
|
.with_header("cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
.query(
|
.query(
|
||||||
QueryPointsBuilder::new("{collection_name}")
|
QueryPointsBuilder::new("{collection_name}")
|
||||||
.query(Query::new_nearest(Document {
|
.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}", {
|
await withHeaders({ 'cohere-api-key': '<YOUR_COHERE_API_KEY>' }, () =>
|
||||||
query: {
|
client.query("{collection_name}", {
|
||||||
text: 'a green square',
|
query: {
|
||||||
model: 'cohere/embed-v4.0',
|
text: 'a green square',
|
||||||
options: {
|
model: 'cohere/embed-v4.0',
|
||||||
'cohere-api-key': '<your_cohere_api_key>',
|
options: {
|
||||||
output_dimension: 512,
|
output_dimension: 512,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
});
|
);
|
||||||
|
|||||||
+18
-16
@@ -5,29 +5,31 @@ public class Snippet
|
|||||||
{
|
{
|
||||||
public static async Task Run()
|
public static async Task Run()
|
||||||
{
|
{
|
||||||
|
// @hide-start
|
||||||
var client = new QdrantClient(
|
var client = new QdrantClient(
|
||||||
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
|
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
await client.UpsertAsync(
|
using (RequestHeaders.Use("cohere-api-key", "<YOUR_COHERE_API_KEY>"))
|
||||||
collectionName: "{collection_name}",
|
await client.UpsertAsync(
|
||||||
points: new List<PointStruct>
|
collectionName: "{collection_name}",
|
||||||
{
|
points: new List<PointStruct>
|
||||||
new()
|
|
||||||
{
|
{
|
||||||
Id = 1,
|
new()
|
||||||
Vectors = new Image()
|
|
||||||
{
|
{
|
||||||
Model = "cohere/embed-v4.0",
|
Id = 1,
|
||||||
Image_ =
|
Vectors = new Image()
|
||||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC",
|
|
||||||
Options =
|
|
||||||
{
|
{
|
||||||
["cohere-api-key"] = "<YOUR_COHERE_API_KEY>",
|
Model = "cohere/embed-v4.0",
|
||||||
["output_dimension"] = 512,
|
Image_ =
|
||||||
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC",
|
||||||
|
Options =
|
||||||
|
{
|
||||||
|
["output_dimension"] = 512,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-19
@@ -2,28 +2,25 @@
|
|||||||
using Qdrant.Client;
|
using Qdrant.Client;
|
||||||
using Qdrant.Client.Grpc;
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
var client = new QdrantClient(
|
using (RequestHeaders.Use("cohere-api-key", "<YOUR_COHERE_API_KEY>"))
|
||||||
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
|
await client.UpsertAsync(
|
||||||
|
collectionName: "{collection_name}",
|
||||||
await client.UpsertAsync(
|
points: new List<PointStruct>
|
||||||
collectionName: "{collection_name}",
|
|
||||||
points: new List<PointStruct>
|
|
||||||
{
|
|
||||||
new()
|
|
||||||
{
|
{
|
||||||
Id = 1,
|
new()
|
||||||
Vectors = new Image()
|
|
||||||
{
|
{
|
||||||
Model = "cohere/embed-v4.0",
|
Id = 1,
|
||||||
Image_ =
|
Vectors = new Image()
|
||||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC",
|
|
||||||
Options =
|
|
||||||
{
|
{
|
||||||
["cohere-api-key"] = "<YOUR_COHERE_API_KEY>",
|
Model = "cohere/embed-v4.0",
|
||||||
["output_dimension"] = 512,
|
Image_ =
|
||||||
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC",
|
||||||
|
Options =
|
||||||
|
{
|
||||||
|
["output_dimension"] = 512,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
|||||||
+2
-8
@@ -5,14 +5,9 @@ import (
|
|||||||
"github.com/qdrant/go-client/qdrant"
|
"github.com/qdrant/go-client/qdrant"
|
||||||
)
|
)
|
||||||
|
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
ctx := qdrant.WithHeader(context.Background(), "cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
Host: "xyz-example.qdrant.io",
|
|
||||||
Port: 6334,
|
|
||||||
APIKey: "<paste-your-api-key-here>",
|
|
||||||
UseTLS: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
client.Upsert(ctx, &qdrant.UpsertPoints{
|
||||||
CollectionName: "{collection_name}",
|
CollectionName: "{collection_name}",
|
||||||
Points: []*qdrant.PointStruct{
|
Points: []*qdrant.PointStruct{
|
||||||
{
|
{
|
||||||
@@ -21,7 +16,6 @@ client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
|||||||
Model: "cohere/embed-v4.0",
|
Model: "cohere/embed-v4.0",
|
||||||
Image: qdrant.NewValueString("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"),
|
Image: qdrant.NewValueString("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"),
|
||||||
Options: qdrant.NewValueMap(map[string]any{
|
Options: qdrant.NewValueMap(map[string]any{
|
||||||
"cohere-api-key": "<YOUR_COHERE_API_KEY>",
|
|
||||||
"output_dimension": 512,
|
"output_dimension": 512,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
+24
-27
@@ -3,39 +3,36 @@ import static io.qdrant.client.PointIdFactory.id;
|
|||||||
import static io.qdrant.client.ValueFactory.value;
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
import static io.qdrant.client.VectorsFactory.vectors;
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.grpc.Context;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.QdrantGrpcClient;
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.RequestHeaders;
|
||||||
import io.qdrant.client.grpc.Points.Image;
|
import io.qdrant.client.grpc.Points.Image;
|
||||||
import io.qdrant.client.grpc.Points.PointStruct;
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
QdrantClient client =
|
Context ctx = RequestHeaders.withHeader(
|
||||||
new QdrantClient(
|
Context.current(), "cohere-api-key", "<YOUR_COHERE_API_KEY>");
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
|
||||||
.withApiKey("<your-api-key")
|
|
||||||
.build());
|
|
||||||
|
|
||||||
client
|
ctx.call(() -> client
|
||||||
.upsertAsync(
|
.upsertAsync(
|
||||||
"{collection_name}",
|
"{collection_name}",
|
||||||
List.of(
|
List.of(
|
||||||
PointStruct.newBuilder()
|
PointStruct.newBuilder()
|
||||||
.setId(id(1))
|
.setId(id(1))
|
||||||
.setVectors(
|
.setVectors(
|
||||||
vectors(
|
vectors(
|
||||||
Image.newBuilder()
|
Image.newBuilder()
|
||||||
.setModel("cohere/embed-v4.0")
|
.setModel("cohere/embed-v4.0")
|
||||||
.setImage(
|
.setImage(
|
||||||
value(
|
value(
|
||||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"))
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"))
|
||||||
.putAllOptions(
|
.putAllOptions(
|
||||||
Map.of(
|
Map.of(
|
||||||
"cohere-api-key",
|
"output_dimension",
|
||||||
value("<YOUR_COHERE_API_KEY>"),
|
value(512)))
|
||||||
"output_dimension",
|
.build()))
|
||||||
value(512)))
|
.build()))
|
||||||
.build()))
|
.get());
|
||||||
.build()))
|
|
||||||
.get();
|
|
||||||
```
|
```
|
||||||
|
|||||||
+17
-16
@@ -1,26 +1,27 @@
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
from qdrant_client.context_headers import headers
|
||||||
|
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
|
||||||
client.upsert(
|
with headers({"cohere-api-key": "<YOUR_COHERE_API_KEY>"}):
|
||||||
collection_name="{collection_name}",
|
client.upsert(
|
||||||
points=[
|
collection_name="{collection_name}",
|
||||||
models.PointStruct(
|
points=[
|
||||||
id=1,
|
models.PointStruct(
|
||||||
vector=models.Document(
|
id=1,
|
||||||
text="a green square",
|
vector=models.Image(
|
||||||
model="cohere/embed-v4.0",
|
image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC",
|
||||||
options={
|
model="cohere/embed-v4.0",
|
||||||
"cohere-api-key": "<your_cohere_api_key>",
|
options={
|
||||||
"output_dimension": 512
|
"output_dimension": 512
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
]
|
||||||
]
|
)
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|||||||
+5
-6
@@ -1,22 +1,21 @@
|
|||||||
```rust
|
```rust
|
||||||
use qdrant_client::{
|
use qdrant_client::{
|
||||||
Payload, Qdrant,
|
Payload, Qdrant,
|
||||||
qdrant::{Document, PointStruct, UpsertPointsBuilder},
|
qdrant::{Image, PointStruct, UpsertPointsBuilder},
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
let client = Qdrant::from_url("<your-qdrant-url>").build()?;
|
|
||||||
let mut options = HashMap::new();
|
let mut options = HashMap::new();
|
||||||
options.insert("cohere-api-key".to_string(), "<YOUR_COHERE_API_KEY>".into());
|
|
||||||
options.insert("output_dimension".to_string(), 512.into());
|
options.insert("output_dimension".to_string(), 512.into());
|
||||||
|
|
||||||
client
|
client
|
||||||
|
.with_header("cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
|
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
|
||||||
vec![
|
vec![
|
||||||
PointStruct::new(1,
|
PointStruct::new(1,
|
||||||
Document {
|
Image {
|
||||||
text: "Recipe for baking chocolate chip cookies requires flour, sugar, eggs, and chocolate chips.".into(),
|
image: Some("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC".into()),
|
||||||
model: "openai/text-embedding-3-small".into(),
|
model: "cohere/embed-v4.0".into(),
|
||||||
options,
|
options,
|
||||||
},
|
},
|
||||||
Payload::default())
|
Payload::default())
|
||||||
|
|||||||
+15
-16
@@ -1,21 +1,20 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
await withHeaders({ 'cohere-api-key': '<YOUR_COHERE_API_KEY>' }, () =>
|
||||||
|
client.upsert("{collection_name}", {
|
||||||
client.upsert("{collection_name}", {
|
points: [
|
||||||
points: [
|
{
|
||||||
{
|
id: 1,
|
||||||
id: 1,
|
vector: {
|
||||||
vector: {
|
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC',
|
||||||
text: 'a green square',
|
model: 'cohere/embed-v4.0',
|
||||||
model: 'cohere/embed-v4.0',
|
options: {
|
||||||
options: {
|
output_dimension: 512,
|
||||||
'cohere-api-key': '<your_cohere_api_key>',
|
},
|
||||||
output_dimension: 512,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
})
|
||||||
});
|
);
|
||||||
```
|
```
|
||||||
|
|||||||
+5
-2
@@ -7,16 +7,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
|
// @hide-start
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
client, err := qdrant.NewClient(&qdrant.Config{
|
||||||
Host: "xyz-example.qdrant.io",
|
Host: "xyz-example.qdrant.io",
|
||||||
Port: 6334,
|
Port: 6334,
|
||||||
APIKey: "<paste-your-api-key-here>",
|
APIKey: "<paste-your-api-key-here>",
|
||||||
UseTLS: true,
|
UseTLS: true,
|
||||||
})
|
})
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
if err != nil { panic(err) } // @hide
|
if err != nil { panic(err) } // @hide
|
||||||
|
|
||||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
ctx := qdrant.WithHeader(context.Background(), "cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
|
|
||||||
|
client.Upsert(ctx, &qdrant.UpsertPoints{
|
||||||
CollectionName: "{collection_name}",
|
CollectionName: "{collection_name}",
|
||||||
Points: []*qdrant.PointStruct{
|
Points: []*qdrant.PointStruct{
|
||||||
{
|
{
|
||||||
@@ -25,7 +29,6 @@ func Main() {
|
|||||||
Model: "cohere/embed-v4.0",
|
Model: "cohere/embed-v4.0",
|
||||||
Image: qdrant.NewValueString("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"),
|
Image: qdrant.NewValueString("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"),
|
||||||
Options: qdrant.NewValueMap(map[string]any{
|
Options: qdrant.NewValueMap(map[string]any{
|
||||||
"cohere-api-key": "<YOUR_COHERE_API_KEY>",
|
|
||||||
"output_dimension": 512,
|
"output_dimension": 512,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
+9
-4
@@ -4,8 +4,10 @@ import static io.qdrant.client.PointIdFactory.id;
|
|||||||
import static io.qdrant.client.ValueFactory.value;
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
import static io.qdrant.client.VectorsFactory.vectors;
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.grpc.Context;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.QdrantGrpcClient;
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.RequestHeaders;
|
||||||
import io.qdrant.client.grpc.Points.Image;
|
import io.qdrant.client.grpc.Points.Image;
|
||||||
import io.qdrant.client.grpc.Points.PointStruct;
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,13 +15,18 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Snippet {
|
public class Snippet {
|
||||||
public static void run() throws Exception {
|
public static void run() throws Exception {
|
||||||
|
// @hide-start
|
||||||
QdrantClient client =
|
QdrantClient client =
|
||||||
new QdrantClient(
|
new QdrantClient(
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||||
.withApiKey("<your-api-key")
|
.withApiKey("<your-api-key")
|
||||||
.build());
|
.build());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
client
|
Context ctx = RequestHeaders.withHeader(
|
||||||
|
Context.current(), "cohere-api-key", "<YOUR_COHERE_API_KEY>");
|
||||||
|
|
||||||
|
ctx.call(() -> client
|
||||||
.upsertAsync(
|
.upsertAsync(
|
||||||
"{collection_name}",
|
"{collection_name}",
|
||||||
List.of(
|
List.of(
|
||||||
@@ -34,12 +41,10 @@ public class Snippet {
|
|||||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"))
|
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"))
|
||||||
.putAllOptions(
|
.putAllOptions(
|
||||||
Map.of(
|
Map.of(
|
||||||
"cohere-api-key",
|
|
||||||
value("<YOUR_COHERE_API_KEY>"),
|
|
||||||
"output_dimension",
|
"output_dimension",
|
||||||
value(512)))
|
value(512)))
|
||||||
.build()))
|
.build()))
|
||||||
.build()))
|
.build()))
|
||||||
.get();
|
.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-16
@@ -1,24 +1,25 @@
|
|||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
from qdrant_client.context_headers import headers
|
||||||
|
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
|
||||||
client.upsert(
|
with headers({"cohere-api-key": "<YOUR_COHERE_API_KEY>"}):
|
||||||
collection_name="{collection_name}",
|
client.upsert(
|
||||||
points=[
|
collection_name="{collection_name}",
|
||||||
models.PointStruct(
|
points=[
|
||||||
id=1,
|
models.PointStruct(
|
||||||
vector=models.Document(
|
id=1,
|
||||||
text="a green square",
|
vector=models.Image(
|
||||||
model="cohere/embed-v4.0",
|
image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC",
|
||||||
options={
|
model="cohere/embed-v4.0",
|
||||||
"cohere-api-key": "<your_cohere_api_key>",
|
options={
|
||||||
"output_dimension": 512
|
"output_dimension": 512
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
]
|
||||||
]
|
)
|
||||||
)
|
|
||||||
|
|||||||
+6
-6
@@ -1,22 +1,22 @@
|
|||||||
use qdrant_client::{
|
use qdrant_client::{
|
||||||
Payload, Qdrant,
|
Payload, Qdrant,
|
||||||
qdrant::{Document, PointStruct, UpsertPointsBuilder},
|
qdrant::{Image, PointStruct, UpsertPointsBuilder},
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub async fn main() -> anyhow::Result<()> {
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
let client = Qdrant::from_url("<your-qdrant-url>").build()?;
|
let client = Qdrant::from_url("<your-qdrant-url>").build()?; // @hide
|
||||||
let mut options = HashMap::new();
|
let mut options = HashMap::new();
|
||||||
options.insert("cohere-api-key".to_string(), "<YOUR_COHERE_API_KEY>".into());
|
|
||||||
options.insert("output_dimension".to_string(), 512.into());
|
options.insert("output_dimension".to_string(), 512.into());
|
||||||
|
|
||||||
client
|
client
|
||||||
|
.with_header("cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
||||||
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
|
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
|
||||||
vec![
|
vec![
|
||||||
PointStruct::new(1,
|
PointStruct::new(1,
|
||||||
Document {
|
Image {
|
||||||
text: "Recipe for baking chocolate chip cookies requires flour, sugar, eggs, and chocolate chips.".into(),
|
image: Some("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC".into()),
|
||||||
model: "openai/text-embedding-3-small".into(),
|
model: "cohere/embed-v4.0".into(),
|
||||||
options,
|
options,
|
||||||
},
|
},
|
||||||
Payload::default())
|
Payload::default())
|
||||||
|
|||||||
+16
-15
@@ -1,19 +1,20 @@
|
|||||||
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.upsert("{collection_name}", {
|
await withHeaders({ 'cohere-api-key': '<YOUR_COHERE_API_KEY>' }, () =>
|
||||||
points: [
|
client.upsert("{collection_name}", {
|
||||||
{
|
points: [
|
||||||
id: 1,
|
{
|
||||||
vector: {
|
id: 1,
|
||||||
text: 'a green square',
|
vector: {
|
||||||
model: 'cohere/embed-v4.0',
|
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC',
|
||||||
options: {
|
model: 'cohere/embed-v4.0',
|
||||||
'cohere-api-key': '<your_cohere_api_key>',
|
options: {
|
||||||
output_dimension: 512,
|
output_dimension: 512,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
})
|
||||||
});
|
);
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
This example upserts a point using OpenAI's `text-embedding-3-large` model. The OpenAI API key is passed in the `options` object in the request body.
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
using Qdrant.Client;
|
||||||
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
|
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.UpsertAsync(
|
||||||
|
collectionName: "{collection_name}",
|
||||||
|
points: new List<PointStruct>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Vectors = new Document()
|
||||||
|
{
|
||||||
|
Model = "openai/text-embedding-3-large",
|
||||||
|
Text = "Recipe for baking chocolate chip cookies",
|
||||||
|
Options = { ["openai-api-key"] = "<YOUR_OPENAI_API_KEY>"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
```csharp
|
||||||
|
using Qdrant.Client;
|
||||||
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
|
await client.UpsertAsync(
|
||||||
|
collectionName: "{collection_name}",
|
||||||
|
points: new List<PointStruct>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Vectors = new Document()
|
||||||
|
{
|
||||||
|
Model = "openai/text-embedding-3-large",
|
||||||
|
Text = "Recipe for baking chocolate chip cookies",
|
||||||
|
Options = { ["openai-api-key"] = "<YOUR_OPENAI_API_KEY>"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
```
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
```go
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "{collection_name}",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(uint64(1)),
|
||||||
|
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
||||||
|
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>",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
```java
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.qdrant.client.QdrantClient;
|
||||||
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
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>")))
|
||||||
|
.build()))
|
||||||
|
.build()))
|
||||||
|
.get();
|
||||||
|
```
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
```python
|
||||||
|
from qdrant_client import QdrantClient, models
|
||||||
|
|
||||||
|
client = QdrantClient(
|
||||||
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
|
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>"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
```
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
```rust
|
||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, PointStruct, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
let mut options = HashMap::new();
|
||||||
|
options.insert("openai-api-key".to_string(), "<YOUR_OPENAI_API_KEY>".into());
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
|
||||||
|
vec![
|
||||||
|
PointStruct::new(1,
|
||||||
|
Document {
|
||||||
|
text: "Recipe for baking chocolate chip cookies".into(),
|
||||||
|
model: "openai/text-embedding-3-large".into(),
|
||||||
|
options,
|
||||||
|
},
|
||||||
|
Payload::default())
|
||||||
|
]).wait(true))
|
||||||
|
.await?;
|
||||||
|
```
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
```typescript
|
||||||
|
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
|
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>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
```
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package snippet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
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.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "{collection_name}",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(uint64(1)),
|
||||||
|
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
||||||
|
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>",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
```http
|
||||||
|
PUT /collections/{collection_name}/points?wait=true
|
||||||
|
{
|
||||||
|
"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>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.example.snippets_amalgamation;
|
||||||
|
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
import static io.qdrant.client.VectorsFactory.vectors;
|
||||||
|
|
||||||
|
import io.qdrant.client.QdrantClient;
|
||||||
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
|
import io.qdrant.client.grpc.Points.PointStruct;
|
||||||
|
import java.util.List;
|
||||||
|
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());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
|
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>")))
|
||||||
|
.build()))
|
||||||
|
.build()))
|
||||||
|
.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
from qdrant_client import QdrantClient, models
|
||||||
|
|
||||||
|
client = QdrantClient(
|
||||||
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
|
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>"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, PointStruct, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
|
let client = Qdrant::from_url("<your-qdrant-url>").build()?; // @hide
|
||||||
|
let mut options = HashMap::new();
|
||||||
|
options.insert("openai-api-key".to_string(), "<YOUR_OPENAI_API_KEY>".into());
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new("{collection_name}",
|
||||||
|
vec![
|
||||||
|
PointStruct::new(1,
|
||||||
|
Document {
|
||||||
|
text: "Recipe for baking chocolate chip cookies".into(),
|
||||||
|
model: "openai/text-embedding-3-large".into(),
|
||||||
|
options,
|
||||||
|
},
|
||||||
|
Payload::default())
|
||||||
|
]).wait(true))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
|
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||||
|
|
||||||
|
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>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
This example upserts a point using OpenAI's `text-embedding-3-large` model. The OpenAI API key is passed in the `openai-api-key` request header.
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
using Qdrant.Client;
|
||||||
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
using (RequestHeaders.Use("openai-api-key", "<YOUR_OPENAI_API_KEY>"))
|
||||||
|
await client.UpsertAsync(
|
||||||
|
collectionName: "{collection_name}",
|
||||||
|
points: new List<PointStruct>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Vectors = new Document()
|
||||||
|
{
|
||||||
|
Model = "openai/text-embedding-3-large",
|
||||||
|
Text = "Recipe for baking chocolate chip cookies",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
```csharp
|
||||||
|
using Qdrant.Client;
|
||||||
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
|
using (RequestHeaders.Use("openai-api-key", "<YOUR_OPENAI_API_KEY>"))
|
||||||
|
await client.UpsertAsync(
|
||||||
|
collectionName: "{collection_name}",
|
||||||
|
points: new List<PointStruct>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Vectors = new Document()
|
||||||
|
{
|
||||||
|
Model = "openai/text-embedding-3-large",
|
||||||
|
Text = "Recipe for baking chocolate chip cookies",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
```
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
```go
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
ctx := qdrant.WithHeader(context.Background(), "openai-api-key", "<YOUR_OPENAI_API_KEY>")
|
||||||
|
|
||||||
|
client.Upsert(ctx, &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "{collection_name}",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(uint64(1)),
|
||||||
|
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
||||||
|
Model: "openai/text-embedding-3-large",
|
||||||
|
Text: "Recipe for baking chocolate chip cookies",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
```java
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
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;
|
||||||
|
|
||||||
|
Context ctx = RequestHeaders.withHeader(
|
||||||
|
Context.current(), "openai-api-key", "<YOUR_OPENAI_API_KEY>");
|
||||||
|
|
||||||
|
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")
|
||||||
|
.build()))
|
||||||
|
.build()))
|
||||||
|
.get());
|
||||||
|
```
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
```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-qdrant-api-key>",
|
||||||
|
cloud_inference=True
|
||||||
|
)
|
||||||
|
|
||||||
|
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",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
```
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
```rust
|
||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, PointStruct, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
client
|
||||||
|
.with_header("openai-api-key", "<YOUR_OPENAI_API_KEY>")
|
||||||
|
.upsert_points(
|
||||||
|
UpsertPointsBuilder::new(
|
||||||
|
"{collection_name}",
|
||||||
|
vec![PointStruct::new(
|
||||||
|
1,
|
||||||
|
Document {
|
||||||
|
text: "Recipe for baking chocolate chip cookies".into(),
|
||||||
|
model: "openai/text-embedding-3-large".into(),
|
||||||
|
options: HashMap::new(),
|
||||||
|
},
|
||||||
|
Payload::default(),
|
||||||
|
)],
|
||||||
|
)
|
||||||
|
.wait(true),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
```
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
```typescript
|
||||||
|
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
```
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package snippet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/qdrant/go-client/qdrant"
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ctx := qdrant.WithHeader(context.Background(), "openai-api-key", "<YOUR_OPENAI_API_KEY>")
|
||||||
|
|
||||||
|
client.Upsert(ctx, &qdrant.UpsertPoints{
|
||||||
|
CollectionName: "{collection_name}",
|
||||||
|
Points: []*qdrant.PointStruct{
|
||||||
|
{
|
||||||
|
Id: qdrant.NewIDNum(uint64(1)),
|
||||||
|
Vectors: qdrant.NewVectorsDocument(&qdrant.Document{
|
||||||
|
Model: "openai/text-embedding-3-large",
|
||||||
|
Text: "Recipe for baking chocolate chip cookies",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package com.example.snippets_amalgamation;
|
||||||
|
|
||||||
|
import static io.qdrant.client.PointIdFactory.id;
|
||||||
|
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;
|
||||||
|
|
||||||
|
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());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
|
Context ctx = RequestHeaders.withHeader(
|
||||||
|
Context.current(), "openai-api-key", "<YOUR_OPENAI_API_KEY>");
|
||||||
|
|
||||||
|
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")
|
||||||
|
.build()))
|
||||||
|
.build()))
|
||||||
|
.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
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-qdrant-api-key>",
|
||||||
|
cloud_inference=True
|
||||||
|
)
|
||||||
|
|
||||||
|
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",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
use qdrant_client::{
|
||||||
|
Payload, Qdrant,
|
||||||
|
qdrant::{Document, PointStruct, UpsertPointsBuilder},
|
||||||
|
};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
|
let client = Qdrant::from_url("<your-qdrant-url>").build()?; // @hide
|
||||||
|
|
||||||
|
client
|
||||||
|
.with_header("openai-api-key", "<YOUR_OPENAI_API_KEY>")
|
||||||
|
.upsert_points(
|
||||||
|
UpsertPointsBuilder::new(
|
||||||
|
"{collection_name}",
|
||||||
|
vec![PointStruct::new(
|
||||||
|
1,
|
||||||
|
Document {
|
||||||
|
text: "Recipe for baking chocolate chip cookies".into(),
|
||||||
|
model: "openai/text-embedding-3-large".into(),
|
||||||
|
options: HashMap::new(),
|
||||||
|
},
|
||||||
|
Payload::default(),
|
||||||
|
)],
|
||||||
|
)
|
||||||
|
.wait(true),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
|
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||||
|
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
@@ -5,8 +5,10 @@ public class Snippet
|
|||||||
{
|
{
|
||||||
public static async Task Run()
|
public static async Task Run()
|
||||||
{
|
{
|
||||||
|
// @hide-start
|
||||||
var client = new QdrantClient(
|
var client = new QdrantClient(
|
||||||
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
|
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
await client.UpsertAsync(
|
await client.UpsertAsync(
|
||||||
collectionName: "{collection_name}",
|
collectionName: "{collection_name}",
|
||||||
|
|||||||
-3
@@ -2,9 +2,6 @@
|
|||||||
using Qdrant.Client;
|
using Qdrant.Client;
|
||||||
using Qdrant.Client.Grpc;
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
var client = new QdrantClient(
|
|
||||||
host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: "<your-api-key>");
|
|
||||||
|
|
||||||
await client.UpsertAsync(
|
await client.UpsertAsync(
|
||||||
collectionName: "{collection_name}",
|
collectionName: "{collection_name}",
|
||||||
points: new List<PointStruct>
|
points: new List<PointStruct>
|
||||||
|
|||||||
-7
@@ -5,13 +5,6 @@ import (
|
|||||||
"github.com/qdrant/go-client/qdrant"
|
"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,
|
|
||||||
})
|
|
||||||
|
|
||||||
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||||
CollectionName: "{collection_name}",
|
CollectionName: "{collection_name}",
|
||||||
Points: []*qdrant.PointStruct{
|
Points: []*qdrant.PointStruct{
|
||||||
|
|||||||
+17
-23
@@ -12,27 +12,21 @@ import io.qdrant.client.grpc.Points.PointStruct;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
QdrantClient client =
|
client
|
||||||
new QdrantClient(
|
.upsertAsync(
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
"{collection_name}",
|
||||||
.withApiKey("<your-api-key")
|
List.of(
|
||||||
.build());
|
PointStruct.newBuilder()
|
||||||
|
.setId(id(1))
|
||||||
client
|
.setVectors(
|
||||||
.upsertAsync(
|
namedVectors(
|
||||||
"{collection_name}",
|
Map.of(
|
||||||
List.of(
|
"my-bm25-vector",
|
||||||
PointStruct.newBuilder()
|
vector(
|
||||||
.setId(id(1))
|
Document.newBuilder()
|
||||||
.setVectors(
|
.setModel("qdrant/bm25")
|
||||||
namedVectors(
|
.setText("Recipe for baking chocolate chip cookies")
|
||||||
Map.of(
|
.build()))))
|
||||||
"my-bm25-vector",
|
.build()))
|
||||||
vector(
|
.get();
|
||||||
Document.newBuilder()
|
|
||||||
.setModel("qdrant/bm25")
|
|
||||||
.setText("Recipe for baking chocolate chip cookies")
|
|
||||||
.build()))))
|
|
||||||
.build()))
|
|
||||||
.get();
|
|
||||||
```
|
```
|
||||||
|
|||||||
-6
@@ -1,12 +1,6 @@
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
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(
|
client.upsert(
|
||||||
collection_name="{collection_name}",
|
collection_name="{collection_name}",
|
||||||
points=[
|
points=[
|
||||||
|
|||||||
-2
@@ -5,8 +5,6 @@ use qdrant_client::{
|
|||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
let client = Qdrant::from_url("<your-qdrant-url>").build()?;
|
|
||||||
|
|
||||||
client
|
client
|
||||||
.upsert_points(UpsertPointsBuilder::new(
|
.upsert_points(UpsertPointsBuilder::new(
|
||||||
"{collection_name}",
|
"{collection_name}",
|
||||||
|
|||||||
-2
@@ -1,8 +1,6 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
|
||||||
|
|
||||||
client.upsert("{collection_name}", {
|
client.upsert("{collection_name}", {
|
||||||
points: [
|
points: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
|
// @hide-start
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
client, err := qdrant.NewClient(&qdrant.Config{
|
||||||
Host: "xyz-example.qdrant.io",
|
Host: "xyz-example.qdrant.io",
|
||||||
Port: 6334,
|
Port: 6334,
|
||||||
APIKey: "<paste-your-api-key-here>",
|
APIKey: "<paste-your-api-key-here>",
|
||||||
UseTLS: true,
|
UseTLS: true,
|
||||||
})
|
})
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
if err != nil { panic(err) } // @hide
|
if err != nil { panic(err) } // @hide
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Snippet {
|
public class Snippet {
|
||||||
public static void run() throws Exception {
|
public static void run() throws Exception {
|
||||||
|
// @hide-start
|
||||||
QdrantClient client =
|
QdrantClient client =
|
||||||
new QdrantClient(
|
new QdrantClient(
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||||
.withApiKey("<your-api-key")
|
.withApiKey("<your-api-key")
|
||||||
.build());
|
.build());
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
client
|
client
|
||||||
.upsertAsync(
|
.upsertAsync(
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
|
||||||
|
# @hide-start
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
# @hide-end
|
||||||
|
|
||||||
client.upsert(
|
client.upsert(
|
||||||
collection_name="{collection_name}",
|
collection_name="{collection_name}",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use qdrant_client::{
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub async fn main() -> anyhow::Result<()> {
|
pub async fn main() -> anyhow::Result<()> {
|
||||||
let client = Qdrant::from_url("<your-qdrant-url>").build()?;
|
let client = Qdrant::from_url("<your-qdrant-url>").build()?; // @hide
|
||||||
|
|
||||||
client
|
client
|
||||||
.upsert_points(UpsertPointsBuilder::new(
|
.upsert_points(UpsertPointsBuilder::new(
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||||
|
|
||||||
client.upsert("{collection_name}", {
|
client.upsert("{collection_name}", {
|
||||||
points: [
|
points: [
|
||||||
|
|||||||
+12
-9
@@ -5,21 +5,24 @@ public class Snippet
|
|||||||
{
|
{
|
||||||
public static async Task Run()
|
public static async Task Run()
|
||||||
{
|
{
|
||||||
|
// @hide-start
|
||||||
var client = new QdrantClient(
|
var client = new QdrantClient(
|
||||||
host: "xyz-example.qdrant.io",
|
host: "xyz-example.qdrant.io",
|
||||||
port: 6334,
|
port: 6334,
|
||||||
https: true,
|
https: true,
|
||||||
apiKey: "<your-api-key>"
|
apiKey: "<your-api-key>"
|
||||||
);
|
);
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
await client.QueryAsync(
|
using (RequestHeaders.Use("jina-api-key", "<YOUR_JINAAI_API_KEY>"))
|
||||||
collectionName: "{collection_name}",
|
await client.QueryAsync(
|
||||||
query: new Document()
|
collectionName: "{collection_name}",
|
||||||
{
|
query: new Document()
|
||||||
Model = "jinaai/jina-clip-v2",
|
{
|
||||||
Text = "Mission to Mars",
|
Model = "jinaai/jina-clip-v2",
|
||||||
Options = { ["jina-api-key"] = "<YOUR_JINAAI_API_KEY>", ["dimensions"] = 512 },
|
Text = "Mission to Mars",
|
||||||
}
|
Options = { ["dimensions"] = 512 },
|
||||||
);
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-16
@@ -2,20 +2,14 @@
|
|||||||
using Qdrant.Client;
|
using Qdrant.Client;
|
||||||
using Qdrant.Client.Grpc;
|
using Qdrant.Client.Grpc;
|
||||||
|
|
||||||
var client = new QdrantClient(
|
using (RequestHeaders.Use("jina-api-key", "<YOUR_JINAAI_API_KEY>"))
|
||||||
host: "xyz-example.qdrant.io",
|
await client.QueryAsync(
|
||||||
port: 6334,
|
collectionName: "{collection_name}",
|
||||||
https: true,
|
query: new Document()
|
||||||
apiKey: "<your-api-key>"
|
{
|
||||||
);
|
Model = "jinaai/jina-clip-v2",
|
||||||
|
Text = "Mission to Mars",
|
||||||
await client.QueryAsync(
|
Options = { ["dimensions"] = 512 },
|
||||||
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 },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
|||||||
+3
-9
@@ -5,22 +5,16 @@ import (
|
|||||||
"github.com/qdrant/go-client/qdrant"
|
"github.com/qdrant/go-client/qdrant"
|
||||||
)
|
)
|
||||||
|
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
ctx := qdrant.WithHeader(context.Background(), "jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||||
Host: "xyz-example.qdrant.io",
|
|
||||||
Port: 6334,
|
|
||||||
APIKey: "<paste-your-api-key-here>",
|
|
||||||
UseTLS: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
client.Query(ctx, &qdrant.QueryPoints{
|
||||||
CollectionName: "{collection_name}",
|
CollectionName: "{collection_name}",
|
||||||
Query: qdrant.NewQueryNearest(
|
Query: qdrant.NewQueryNearest(
|
||||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
Text: "Mission to Mars",
|
Text: "Mission to Mars",
|
||||||
Model: "jinaai/jina-clip-v2",
|
Model: "jinaai/jina-clip-v2",
|
||||||
Options: qdrant.NewValueMap(map[string]any{
|
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.QueryFactory.nearest;
|
||||||
import static io.qdrant.client.ValueFactory.value;
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
|
||||||
|
import io.grpc.Context;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.QdrantGrpcClient;
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.RequestHeaders;
|
||||||
import io.qdrant.client.grpc.Points.Document;
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
import io.qdrant.client.grpc.Points.QueryPoints;
|
import io.qdrant.client.grpc.Points.QueryPoints;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
QdrantClient client =
|
Context ctx = RequestHeaders.withHeader(
|
||||||
new QdrantClient(
|
Context.current(), "jina-api-key", "<YOUR_JINAAI_API_KEY>");
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
|
||||||
.withApiKey("<your-api-key")
|
ctx.call(() -> client
|
||||||
.build());
|
|
||||||
client
|
|
||||||
.queryAsync(
|
.queryAsync(
|
||||||
QueryPoints.newBuilder()
|
QueryPoints.newBuilder()
|
||||||
.setCollectionName("{collection_name}")
|
.setCollectionName("{collection_name}")
|
||||||
@@ -24,11 +24,9 @@ client
|
|||||||
.setText("Mission to Mars")
|
.setText("Mission to Mars")
|
||||||
.putAllOptions(
|
.putAllOptions(
|
||||||
Map.of(
|
Map.of(
|
||||||
"jina-api-key",
|
|
||||||
value("<YOUR_JINAAI_API_KEY>"),
|
|
||||||
"dimensions",
|
"dimensions",
|
||||||
value(512)))
|
value(512)))
|
||||||
.build()))
|
.build()))
|
||||||
.build())
|
.build())
|
||||||
.get();
|
.get());
|
||||||
```
|
```
|
||||||
|
|||||||
+12
-11
@@ -1,21 +1,22 @@
|
|||||||
```python
|
```python
|
||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
from qdrant_client.context_headers import headers
|
||||||
|
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
|
||||||
client.query_points(
|
with headers({"jina-api-key": "<YOUR_JINAAI_API_KEY>"}):
|
||||||
collection_name="{collection_name}",
|
client.query_points(
|
||||||
query=models.Document(
|
collection_name="{collection_name}",
|
||||||
text="Mission to Mars",
|
query=models.Document(
|
||||||
model="jinaai/jina-clip-v2",
|
text="Mission to Mars",
|
||||||
options={
|
model="jinaai/jina-clip-v2",
|
||||||
"jina-api-key": "<your_jinaai_api_key>",
|
options={
|
||||||
"dimensions": 512
|
"dimensions": 512
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|||||||
+1
-3
@@ -5,13 +5,11 @@ use qdrant_client::{
|
|||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
let client = Qdrant::from_url("<your-qdrant-url>").build().unwrap();
|
|
||||||
|
|
||||||
let mut options = HashMap::<String, Value>::new();
|
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());
|
options.insert("dimensions".to_string(), 512.into());
|
||||||
|
|
||||||
client
|
client
|
||||||
|
.with_header("jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||||
.query(
|
.query(
|
||||||
QueryPointsBuilder::new("{collection_name}")
|
QueryPointsBuilder::new("{collection_name}")
|
||||||
.query(Query::new_nearest(Document {
|
.query(Query::new_nearest(Document {
|
||||||
|
|||||||
+11
-12
@@ -1,16 +1,15 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
import { QdrantClient, withHeaders } from "@qdrant/js-client-rest";
|
||||||
|
|
||||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
await withHeaders({ 'jina-api-key': '<YOUR_JINAAI_API_KEY>' }, () =>
|
||||||
|
client.query("{collection_name}", {
|
||||||
client.query("{collection_name}", {
|
query: {
|
||||||
query: {
|
text: 'Mission to Mars',
|
||||||
text: 'Mission to Mars',
|
model: 'jinaai/jina-clip-v2',
|
||||||
model: 'jinaai/jina-clip-v2',
|
options: {
|
||||||
options: {
|
dimensions: 512,
|
||||||
'jina-api-key': '<your_jinaai_api_key>',
|
},
|
||||||
dimensions: 512,
|
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
});
|
);
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -7,24 +7,27 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
|
// @hide-start
|
||||||
client, err := qdrant.NewClient(&qdrant.Config{
|
client, err := qdrant.NewClient(&qdrant.Config{
|
||||||
Host: "xyz-example.qdrant.io",
|
Host: "xyz-example.qdrant.io",
|
||||||
Port: 6334,
|
Port: 6334,
|
||||||
APIKey: "<paste-your-api-key-here>",
|
APIKey: "<paste-your-api-key-here>",
|
||||||
UseTLS: true,
|
UseTLS: true,
|
||||||
})
|
})
|
||||||
|
// @hide-end
|
||||||
|
|
||||||
if err != nil { panic(err) } // @hide
|
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}",
|
CollectionName: "{collection_name}",
|
||||||
Query: qdrant.NewQueryNearest(
|
Query: qdrant.NewQueryNearest(
|
||||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||||
Text: "Mission to Mars",
|
Text: "Mission to Mars",
|
||||||
Model: "jinaai/jina-clip-v2",
|
Model: "jinaai/jina-clip-v2",
|
||||||
Options: qdrant.NewValueMap(map[string]any{
|
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.QueryFactory.nearest;
|
||||||
import static io.qdrant.client.ValueFactory.value;
|
import static io.qdrant.client.ValueFactory.value;
|
||||||
|
|
||||||
|
import io.grpc.Context;
|
||||||
import io.qdrant.client.QdrantClient;
|
import io.qdrant.client.QdrantClient;
|
||||||
import io.qdrant.client.QdrantGrpcClient;
|
import io.qdrant.client.QdrantGrpcClient;
|
||||||
|
import io.qdrant.client.RequestHeaders;
|
||||||
import io.qdrant.client.grpc.Points.Document;
|
import io.qdrant.client.grpc.Points.Document;
|
||||||
import io.qdrant.client.grpc.Points.QueryPoints;
|
import io.qdrant.client.grpc.Points.QueryPoints;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Snippet {
|
public class Snippet {
|
||||||
public static void run() throws Exception {
|
public static void run() throws Exception {
|
||||||
|
// @hide-start
|
||||||
QdrantClient client =
|
QdrantClient client =
|
||||||
new QdrantClient(
|
new QdrantClient(
|
||||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||||
.withApiKey("<your-api-key")
|
.withApiKey("<your-api-key")
|
||||||
.build());
|
.build());
|
||||||
client
|
// @hide-end
|
||||||
|
|
||||||
|
Context ctx = RequestHeaders.withHeader(
|
||||||
|
Context.current(), "jina-api-key", "<YOUR_JINAAI_API_KEY>");
|
||||||
|
|
||||||
|
ctx.call(() -> client
|
||||||
.queryAsync(
|
.queryAsync(
|
||||||
QueryPoints.newBuilder()
|
QueryPoints.newBuilder()
|
||||||
.setCollectionName("{collection_name}")
|
.setCollectionName("{collection_name}")
|
||||||
@@ -27,12 +35,10 @@ public class Snippet {
|
|||||||
.setText("Mission to Mars")
|
.setText("Mission to Mars")
|
||||||
.putAllOptions(
|
.putAllOptions(
|
||||||
Map.of(
|
Map.of(
|
||||||
"jina-api-key",
|
|
||||||
value("<YOUR_JINAAI_API_KEY>"),
|
|
||||||
"dimensions",
|
"dimensions",
|
||||||
value(512)))
|
value(512)))
|
||||||
.build()))
|
.build()))
|
||||||
.build())
|
.build())
|
||||||
.get();
|
.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-11
@@ -1,19 +1,20 @@
|
|||||||
from qdrant_client import QdrantClient, models
|
from qdrant_client import QdrantClient, models
|
||||||
|
from qdrant_client.context_headers import headers
|
||||||
|
|
||||||
client = QdrantClient(
|
client = QdrantClient(
|
||||||
url="https://xyz-example.qdrant.io:6333",
|
url="https://xyz-example.qdrant.io:6333",
|
||||||
api_key="<your-api-key>",
|
api_key="<your-qdrant-api-key>",
|
||||||
cloud_inference=True
|
cloud_inference=True
|
||||||
)
|
)
|
||||||
|
|
||||||
client.query_points(
|
with headers({"jina-api-key": "<YOUR_JINAAI_API_KEY>"}):
|
||||||
collection_name="{collection_name}",
|
client.query_points(
|
||||||
query=models.Document(
|
collection_name="{collection_name}",
|
||||||
text="Mission to Mars",
|
query=models.Document(
|
||||||
model="jinaai/jina-clip-v2",
|
text="Mission to Mars",
|
||||||
options={
|
model="jinaai/jina-clip-v2",
|
||||||
"jina-api-key": "<your_jinaai_api_key>",
|
options={
|
||||||
"dimensions": 512
|
"dimensions": 512
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|||||||
+2
-2
@@ -5,13 +5,13 @@ use qdrant_client::{
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub async fn main() -> anyhow::Result<()> {
|
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();
|
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());
|
options.insert("dimensions".to_string(), 512.into());
|
||||||
|
|
||||||
client
|
client
|
||||||
|
.with_header("jina-api-key", "<YOUR_JINAAI_API_KEY>")
|
||||||
.query(
|
.query(
|
||||||
QueryPointsBuilder::new("{collection_name}")
|
QueryPointsBuilder::new("{collection_name}")
|
||||||
.query(Query::new_nearest(Document {
|
.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}", {
|
await withHeaders({ 'jina-api-key': '<YOUR_JINAAI_API_KEY>' }, () =>
|
||||||
query: {
|
client.query("{collection_name}", {
|
||||||
text: 'Mission to Mars',
|
query: {
|
||||||
model: 'jinaai/jina-clip-v2',
|
text: 'Mission to Mars',
|
||||||
options: {
|
model: 'jinaai/jina-clip-v2',
|
||||||
'jina-api-key': '<your_jinaai_api_key>',
|
options: {
|
||||||
dimensions: 512,
|
dimensions: 512,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
});
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user