diff --git a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/csharp.md b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/csharp.md index e21793ac8..dc17e4c49 100644 --- a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/csharp.md +++ b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/csharp.md @@ -16,7 +16,7 @@ await client.UpsertAsync( new() { Id = 1, Vectors = new Image() { - Image = "https://qdrant.tech/example.png", + Image_ = "https://qdrant.tech/example.png", Model = "qdrant/clip-vit-b-32-vision", }, Payload = { diff --git a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/go.md b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/go.md index de36669c0..ecd2cae82 100644 --- a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/go.md +++ b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/go.md @@ -24,14 +24,14 @@ func main() { } defer client.Close() - _, err = client.GetPointsClient().Upsert(ctx, &qdrant.UpsertPoints{ + _, err = client.Upsert(ctx, &qdrant.UpsertPoints{ CollectionName: "", Points: []*qdrant.PointStruct{ { - Id: qdrant.NewIDNum(uint64(1)), + Id: qdrant.NewIDNum(1), Vectors: qdrant.NewVectorsImage(&qdrant.Image{ - Image: "https://qdrant.tech/example.png", Model: "qdrant/clip-vit-b-32-vision", + Image: qdrant.NewValueString("https://qdrant.tech/example.png"), }), Payload: qdrant.NewValueMap(map[string]any{ "title": "Example image", diff --git a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/java.md b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/java.md index bee29ab3c..e278b899a 100644 --- a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/java.md +++ b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/image/java.md @@ -32,7 +32,7 @@ public class Main { .setVectors( vectors( Image.newBuilder() - .setImage("https://qdrant.tech/example.png") + .setImage(value("https://qdrant.tech/example.png")) .setModel("qdrant/clip-vit-b-32-vision") .build())) .putAllPayload(Map.of("title", value("Example Image"))) diff --git a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/simple/go.md b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/simple/go.md index 3c0863520..920730162 100644 --- a/qdrant-landing/content/documentation/headless/snippets/cloud-inference/simple/go.md +++ b/qdrant-landing/content/documentation/headless/snippets/cloud-inference/simple/go.md @@ -24,11 +24,11 @@ func main() { } defer client.Close() - _, err = client.GetPointsClient().Upsert(ctx, &qdrant.UpsertPoints{ + _, err = client.Upsert(ctx, &qdrant.UpsertPoints{ CollectionName: "", Points: []*qdrant.PointStruct{ { - Id: qdrant.NewIDNum(uint64(1)), + Id: qdrant.NewIDNum(1), Vectors: qdrant.NewVectorsDocument(&qdrant.Document{ Text: "Recipe for baking chocolate chip cookies", Model: "", diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/csharp.md new file mode 100644 index 000000000..84046362b --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/csharp.md @@ -0,0 +1,21 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( + host: "xyz-example.qdrant.io", + port: 6334, + https: true, + apiKey: "" +); + +await client.QueryAsync( + collectionName: "{collection_name}", + query: new Document() + { + Model = "cohere/embed-v4.0", + Text = "a green square", + Options = { ["cohere-api-key"] = "", ["output_dimension"] = 512 }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/go.md new file mode 100644 index 000000000..3ac36e398 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/go.md @@ -0,0 +1,29 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Query(ctx, &qdrant.QueryPoints{ + CollectionName: "{collection_name}", + Query: qdrant.NewQueryNearest( + qdrant.NewVectorInputDocument(&qdrant.Document{ + Text: "a green square", + Model: "cohere/embed-v4.0", + Options: qdrant.NewValueMap(map[string]any{ + "cohere-api-key": "", + "output_dimension": 512, + }), + }), + ), +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/http.md index 4cc6b228e..b5b3603e2 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/http.md @@ -1,5 +1,5 @@ ```http -POST /collections//points/query +POST /collections/{collection_name}/points/query { "query": { "text": "a green square", diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/java.md new file mode 100644 index 000000000..e2700e165 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/java.md @@ -0,0 +1,34 @@ +```java +import static io.qdrant.client.QueryFactory.nearest; +import static io.qdrant.client.ValueFactory.value; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; +import io.qdrant.client.grpc.Points.Document; +import java.util.Map; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "output_dimension", + value(512))) + .build())) + .build()) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/python.md new file mode 100644 index 000000000..da3be64c8 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/python.md @@ -0,0 +1,21 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + api_key="", + cloud_inference=True +) + +client.query_points( + collection_name="{collection_name}", + query=models.Document( + text="a green square", + model="cohere/embed-v4.0", + options={ + "cohere-api-key": "", + "output_dimension": 512 + } + ) +) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/rust.md new file mode 100644 index 000000000..c9b1b3208 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/rust.md @@ -0,0 +1,25 @@ +```rust +use qdrant_client::{ + Qdrant, QdrantError, + qdrant::{Document, Query, QueryPointsBuilder, Value}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("http://localhost:6333").build().unwrap(); + +let mut options = HashMap::::new(); +options.insert("cohere-api-key".to_string(), "".into()); +options.insert("output_dimension".to_string(), 512.into()); + +client + .query( + QueryPointsBuilder::new("{collection_name}") + .query(Query::new_nearest(Document { + text: "a green square".into(), + model: "cohere/embed-v4.0".into(), + options, + })) + .build(), + ) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/typescript.md new file mode 100644 index 000000000..4a6c22961 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-query/typescript.md @@ -0,0 +1,16 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.query("{collection_name}", { + query: { + text: 'a green square', + model: 'cohere/embed-v4.0', + options: { + 'cohere-api-key': '', + output_dimension: 512, + }, + }, +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/csharp.md new file mode 100644 index 000000000..fcb503326 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/csharp.md @@ -0,0 +1,29 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( +host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: ""); + +await client.UpsertAsync( + collectionName: "{collection_name}", + points: new List + { + new() + { + Id = 1, + Vectors = new Image() + { + Model = "cohere/embed-v4.0", + Image_ = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC", + Options = + { + ["cohere-api-key"] = "", + ["output_dimension"] = 512, + }, + }, + }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/go.md new file mode 100644 index 000000000..2eb5c51e6 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/go.md @@ -0,0 +1,32 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Upsert(ctx, &qdrant.UpsertPoints{ + CollectionName: "{collection_name}", + Points: []*qdrant.PointStruct{ + { + Id: qdrant.NewIDNum(uint64(1)), + Vectors: qdrant.NewVectorsImage(&qdrant.Image{ + Model: "cohere/embed-v4.0", + Image: qdrant.NewValueString("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjmAAAAAElFTkSuQmCC"), + Options: qdrant.NewValueMap(map[string]any{ + "cohere-api-key": "", + "output_dimension": 512, + }), + }), + }, + }, +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/http.md index 96e1500cf..b0f4e4140 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/http.md @@ -1,5 +1,5 @@ ```http -PUT /collections//points?wait=true +PUT /collections/{collection_name}/points?wait=true { "points": [ { diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/java.md new file mode 100644 index 000000000..42096100a --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/java.md @@ -0,0 +1,41 @@ +```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.Image; +import io.qdrant.client.grpc.Points.PointStruct; +import java.util.List; +import java.util.Map; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "output_dimension", + value(512))) + .build())) + .build())) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/python.md new file mode 100644 index 000000000..e9323e716 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/python.md @@ -0,0 +1,26 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + api_key="", + cloud_inference=True +) + +client.upsert( + collection_name="{collection_name}", + points=[ + models.PointStruct( + id=1, + vector=models.Document( + text="a green square", + model="cohere/embed-v4.0", + options={ + "cohere-api-key": "", + "output_dimension": 512 + } + ) + ) + ] +) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/rust.md new file mode 100644 index 000000000..1539eebdf --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/rust.md @@ -0,0 +1,25 @@ +```rust +use qdrant_client::{ + Payload, Qdrant, QdrantError, + qdrant::{Document, PointStruct, UpsertPointsBuilder}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("").build()?; +let mut options = HashMap::new(); +options.insert("cohere-api-key".to_string(), "".into()); +options.insert("output_dimension".to_string(), 512.into()); + +client + .upsert_points(UpsertPointsBuilder::new("{collection_name}", + vec![ + PointStruct::new(1, + Document { + text: "Recipe for baking chocolate chip cookies requires flour, sugar, eggs, and chocolate chips.".into(), + model: "openai/text-embedding-3-small".into(), + options, + }, + Payload::default()) + ]).wait(true)) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/typescript.md new file mode 100644 index 000000000..e08598b6e --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/cohere-upsert/typescript.md @@ -0,0 +1,21 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.upsert("{collection_name}", { + points: [ + { + id: 1, + vector: { + text: 'a green square', + model: 'cohere/embed-v4.0', + options: { + 'cohere-api-key': '', + output_dimension: 512, + }, + }, + }, + ], +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/ingest/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/csharp.md new file mode 100644 index 000000000..ff0432603 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/csharp.md @@ -0,0 +1,26 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( +host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: ""); + +await client.UpsertAsync( + collectionName: "{collection_name}", + points: new List + { + new() + { + Id = 1, + Vectors = new Dictionary + { + ["my-bm25-vector"] = new Document() + { + Model = "qdrant/bm25", + Text = "Recipe for baking chocolate chip cookies", + }, + }, + }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/ingest/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/go.md new file mode 100644 index 000000000..0183f7f79 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/go.md @@ -0,0 +1,30 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Upsert(ctx, &qdrant.UpsertPoints{ + CollectionName: "{collection_name}", + Points: []*qdrant.PointStruct{ + { + Id: qdrant.NewIDNum(uint64(1)), + Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{ + "my-bm25-vector": qdrant.NewVectorDocument(&qdrant.Document{ + Model: "qdrant/bm25", + Text: "Recipe for baking chocolate chip cookies", + }), + }), + }, + }, +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/ingest/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/http.md index b8c04088d..8e5f0a69a 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/ingest/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/http.md @@ -1,5 +1,5 @@ ```http -PUT /collections//points +PUT /collections/{collection_name}/points { "points": [ { diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/ingest/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/java.md new file mode 100644 index 000000000..3c41c4607 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/java.md @@ -0,0 +1,38 @@ +```java +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.ValueFactory.value; +import static io.qdrant.client.VectorFactory.vector; +import static io.qdrant.client.VectorsFactory.namedVectors; + + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; +import io.qdrant.client.grpc.Points.Image; +import io.qdrant.client.grpc.Points.PointStruct; +import java.util.List; +import java.util.Map; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey("").build()?; + +client + .upsert_points(UpsertPointsBuilder::new("{collection_name}", + vec![ + PointStruct::new(1, + HashMap::from([("my-bm25-vector".to_string(), + Document { + text: "Recipe for baking chocolate chip cookies".into(), + model: "qdrant/bm25".into(), + ..Default::default() + }.into())]), + Payload::default()) + ])) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/ingest/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/typescript.md new file mode 100644 index 000000000..33ffb504c --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/ingest/typescript.md @@ -0,0 +1,19 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.upsert("{collection_name}", { + points: [ + { + id: 1, + vector: { + 'my-bm25-vector': { + text: 'Recipe for baking chocolate chip cookies', + model: 'Qdrant/bm25', + }, + }, + }, + ], +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/csharp.md new file mode 100644 index 000000000..4a2500d3e --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/csharp.md @@ -0,0 +1,21 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( + host: "xyz-example.qdrant.io", + port: 6334, + https: true, + apiKey: "" +); + +await client.QueryAsync( + collectionName: "{collection_name}", + query: new Document() + { + Model = "jinaai/jina-clip-v2", + Text = "Mission to Mars", + Options = { ["jina-api-key"] = "", ["dimensions"] = 512 }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/go.md new file mode 100644 index 000000000..b867af1e4 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/go.md @@ -0,0 +1,29 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Query(ctx, &qdrant.QueryPoints{ + CollectionName: "{collection_name}", + Query: qdrant.NewQueryNearest( + qdrant.NewVectorInputDocument(&qdrant.Document{ + Text: "Mission to Mars", + Model: "jinaai/jina-clip-v2", + Options: qdrant.NewValueMap(map[string]any{ + "jina-api-key": "", + "dimensions": 512, + }), + }), + ), +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/http.md index 5a6e4617f..2997da261 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/http.md @@ -1,5 +1,5 @@ ```http -POST /collections//points/query +POST /collections/{collection_name}/points/query { "query": { "text": "Mission to Mars", diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/java.md new file mode 100644 index 000000000..749b972a8 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/java.md @@ -0,0 +1,33 @@ +```java +import static io.qdrant.client.QueryFactory.nearest; +import static io.qdrant.client.ValueFactory.value; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; +import io.qdrant.client.grpc.Points.Document; +import java.util.Map; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "dimensions", + value(512))) + .build())) + .build()) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/python.md new file mode 100644 index 000000000..3c08bd5f2 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/python.md @@ -0,0 +1,21 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + api_key="", + cloud_inference=True +) + +client.query_points( + collection_name="{collection_name}", + query=models.Document( + text="Mission to Mars", + model="jinaai/jina-clip-v2", + options={ + "jina-api-key": "", + "dimensions": 512 + } + ) +) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/rust.md new file mode 100644 index 000000000..d91e2f515 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/rust.md @@ -0,0 +1,25 @@ +```rust +use qdrant_client::{ + Qdrant, QdrantError, + qdrant::{Document, Query, QueryPointsBuilder, Value}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("").build().unwrap(); + +let mut options = HashMap::::new(); +options.insert("jina-api-key".to_string(), "".into()); +options.insert("dimensions".to_string(), 512.into()); + +client + .query( + QueryPointsBuilder::new("{collection_name}") + .query(Query::new_nearest(Document { + text: "Mission to Mars".into(), + model: "jinaai/jina-clip-v2".into(), + options, + })) + .build(), + ) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/typescript.md new file mode 100644 index 000000000..32b6e5f6d --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-query/typescript.md @@ -0,0 +1,16 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.query("{collection_name}", { + query: { + text: 'Mission to Mars', + model: 'jinaai/jina-clip-v2', + options: { + 'jina-api-key': '', + dimensions: 512, + }, + }, +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/csharp.md new file mode 100644 index 000000000..d151ed9cf --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/csharp.md @@ -0,0 +1,28 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( + host: "xyz-example.qdrant.io", + port: 6334, + https: true, + apiKey: "" +); + +await client.UpsertAsync( + collectionName: "{collection_name}", + points: new List + { + new() + { + Id = 1, + Vectors = new Document() + { + Model = "jinaai/jina-clip-v2", + Text = "Mission to Mars", + Options = { ["jina-api-key"] = "", ["dimensions"] = 512 }, + }, + }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/go.md new file mode 100644 index 000000000..415840c38 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/go.md @@ -0,0 +1,32 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Upsert(ctx, &qdrant.UpsertPoints{ + CollectionName: "{collection_name}", + Points: []*qdrant.PointStruct{ + { + Id: qdrant.NewIDNum(uint64(1)), + Vectors: qdrant.NewVectorsImage(&qdrant.Image{ + Model: "jinaai/jina-clip-v2", + Image: qdrant.NewValueString("https://qdrant.tech/example.png"), + Options: qdrant.NewValueMap(map[string]any{ + "jina-api-key": "", + "dimensions": 512, + }), + }), + }, + }, +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/http.md index da49a6144..99828d251 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/http.md @@ -1,5 +1,5 @@ ```http -PUT /collections//points?wait=true +PUT /collections/{collection_name}/points?wait=true { "points": [ { diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/java.md new file mode 100644 index 000000000..7353a5c03 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/java.md @@ -0,0 +1,39 @@ +```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.Image; +import io.qdrant.client.grpc.Points.PointStruct; +import java.util.List; +import java.util.Map; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "dimensions", + value(512))) + .build())) + .build())) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/python.md new file mode 100644 index 000000000..a209a6f52 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/python.md @@ -0,0 +1,26 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + api_key="", + cloud_inference=True +) + +client.upsert( + collection_name="{collection_name}", + points=[ + models.PointStruct( + id=1, + vector=models.Image( + image="https://qdrant.tech/example.png", + model="jinaai/jina-clip-v2", + options={ + "jina-api-key": "", + "dimensions": 512 + } + ) + ) + ] +) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/rust.md new file mode 100644 index 000000000..953e772f5 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/rust.md @@ -0,0 +1,25 @@ +```rust +use qdrant_client::{ + Payload, Qdrant, QdrantError, + qdrant::{Image, PointStruct, UpsertPointsBuilder}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("").build()?; +let mut options = HashMap::new(); +options.insert("jina-api-key".to_string(), "".into()); +options.insert("dimensions".to_string(), 512.into()); + +client + .upsert_points(UpsertPointsBuilder::new("{collection_name}", + vec![ + PointStruct::new(1, + Image { + image: Some("https://qdrant.tech/example.png".into()), + model: "jinaai/jina-clip-v2".into(), + options, + }, + Payload::default()) + ]).wait(true)) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/typescript.md new file mode 100644 index 000000000..271078003 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/jinaai-upsert/typescript.md @@ -0,0 +1,21 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.upsert("{collection_name}", { + points: [ + { + id: 1, + vector: { + image: 'https://qdrant.tech/example.png', + model: 'jinaai/jina-clip-v2', + options: { + 'jina-api-key': '', + dimensions: 512, + }, + }, + }, + ], +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/csharp.md new file mode 100644 index 000000000..1b4ac4f2b --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/csharp.md @@ -0,0 +1,33 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( +host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: ""); + +await client.UpsertAsync( + collectionName: "{collection_name}", + points: new List + { + new() + { + Id = 1, + Vectors = new Dictionary + { + ["image"] = new Image() + { + Model = "jinaai/jina-clip-v2", + Image_ = "https://qdrant.tech/example.png", + Options = { ["jina-api-key"] = "", ["dimensions"] = 512 }, + }, + ["text"] = new Document() + { + Model = "sentence-transformers/all-minilm-l6-v2", + Text = "Mars, the red planet", + }, + ["bm25"] = new Document() { Model = "qdrant/bm25", Text = "Mars, the red planet" }, + }, + }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/go.md new file mode 100644 index 000000000..de3d30719 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/go.md @@ -0,0 +1,42 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Upsert(ctx, &qdrant.UpsertPoints{ + CollectionName: "{collection_name}", + Points: []*qdrant.PointStruct{ + { + Id: qdrant.NewIDNum(uint64(1)), + Vectors: qdrant.NewVectorsMap(map[string]*qdrant.Vector{ + "image": qdrant.NewVectorImage(&qdrant.Image{ + Model: "jinaai/jina-clip-v2", + Image: qdrant.NewValueString("https://qdrant.tech/example.png"), + Options: qdrant.NewValueMap(map[string]any{ + "jina-api-key": "", + "dimensions": 512, + }), + }), + "text": qdrant.NewVectorDocument(&qdrant.Document{ + Model: "sentence-transformers/all-minilm-l6-v2", + Text: "Mars, the red planet", + }), + "my-bm25-vector": qdrant.NewVectorDocument(&qdrant.Document{ + Model: "qdrant/bm25", + Text: "Recipe for baking chocolate chip cookies", + }), + }), + }, + }, +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/http.md index 4bd76dab8..d7244dca3 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/http.md @@ -1,5 +1,5 @@ ```http -PUT /collections//points?wait=true +PUT /collections/{collection_name}/points?wait=true { "points": [ { diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/java.md new file mode 100644 index 000000000..6599b8c0e --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/java.md @@ -0,0 +1,56 @@ +```java +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.ValueFactory.value; +import static io.qdrant.client.VectorFactory.vector; +import static io.qdrant.client.VectorsFactory.namedVectors; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; +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; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "dimensions", + value(512))) + .build()), + "text", + vector( + Document.newBuilder() + .setModel("sentence-transformers/all-minilm-l6-v2") + .setText("Mars, the red planet") + .build()), + "bm25", + vector( + Document.newBuilder() + .setModel("qdrant/bm25") + .setText("Mars, the red planet") + .build())))) + .build())) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/python.md new file mode 100644 index 000000000..93b166049 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/python.md @@ -0,0 +1,37 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + api_key="", + cloud_inference=True +) + +client.upsert( + collection_name="{collection_name}", + points=[ + models.PointStruct( + id=1, + vector={ + "image": models.Image( + image="https://qdrant.tech/example.png", + model="jinaai/jina-clip-v2", + options={ + "jina-api-key": "", + "dimensions": 512 + }, + ), + "text": models.Document( + text="Mars, the red planet", + model="sentence-transformers/all-minilm-l6-v2", + ), + "bm25": models.Document( + text="Mars, the red planet", + model="Qdrant/bm25", + ), + }, + ) + ], +) + +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/rust.md new file mode 100644 index 000000000..ba73737db --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/rust.md @@ -0,0 +1,51 @@ +```rust +use qdrant_client::{ + Payload, Qdrant, QdrantError, + qdrant::{Document, PointStruct, UpsertPointsBuilder, Vectors}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("").build()?; + +let mut jina_options = HashMap::new(); +jina_options.insert("jina-api-key".to_string(), "".into()); +jina_options.insert("dimensions".to_string(), 512.into()); + +client + .upsert_points( + UpsertPointsBuilder::new( + "{collection_name}", + vec![PointStruct::new( + 1, + NamedVectors::default() + .add_vector( + "image", + Image { + image: Some("https://qdrant.tech/example.png".into()), + model: "jinaai/jina-clip-v2".into(), + options: jina_options, + }, + ) + .add_vector( + "text", + Document { + text: "Mars, the red planet".into(), + model: "sentence-transformers/all-minilm-l6-v2".into(), + ..Default::default() + }, + ) + .add_vector( + "bm25", + Document { + text: "How to bake cookies?".into(), + model: "qdrant/bm25".into(), + ..Default::default() + }, + ), + Payload::default(), + )], + ) + .wait(true), + ) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/multiple/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/typescript.md new file mode 100644 index 000000000..a18ce230e --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/multiple/typescript.md @@ -0,0 +1,31 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.upsert("{collection_name}", { + points: [ + { + id: 1, + vector: { + image: { + image: 'https://qdrant.tech/example.png', + model: 'jinaai/jina-clip-v2', + options: { + 'jina-api-key': '', + dimensions: 512, + }, + }, + text: { + text: 'Mars, the red planet', + model: 'sentence-transformers/all-minilm-l6-v2', + }, + bm25: { + text: 'Mars, the red planet', + model: 'Qdrant/bm25', + }, + }, + }, + ], +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/csharp.md new file mode 100644 index 000000000..ce9502393 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/csharp.md @@ -0,0 +1,21 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( + host: "xyz-example.qdrant.io", + port: 6334, + https: true, + apiKey: "" +); + +await client.QueryAsync( + collectionName: "{collection_name}", + query: new Document() + { + Model = "openai/text-embedding-3-large", + Text = "How to bake cookies?", + Options = { ["openai-api-key"] = "", ["dimensions"] = 512 }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/go.md new file mode 100644 index 000000000..e63b813b2 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/go.md @@ -0,0 +1,29 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Query(ctx, &qdrant.QueryPoints{ + CollectionName: "{collection_name}", + Query: qdrant.NewQueryNearest( + qdrant.NewVectorInputDocument(&qdrant.Document{ + Model: "openai/text-embedding-3-large", + Text: "How to bake cookies?", + Options: qdrant.NewValueMap(map[string]any{ + "openai-api-key": "", + "dimensions": 512, + }), + }), + ), +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/http.md index 1c75f35b4..6d3ca11f3 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/http.md @@ -1,5 +1,5 @@ ```http -POST /collections//points/query +POST /collections/{collection_name}/points/query { "query": { "text": "How to bake cookies?", diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/java.md new file mode 100644 index 000000000..5d05eceb6 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/java.md @@ -0,0 +1,33 @@ +```java +import static io.qdrant.client.QueryFactory.nearest; +import static io.qdrant.client.ValueFactory.value; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; +import io.qdrant.client.grpc.Points.Document; +import java.util.Map; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "dimensions", + value(512))) + .build())) + .build()) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/python.md new file mode 100644 index 000000000..9545b729c --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/python.md @@ -0,0 +1,21 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + api_key="", + cloud_inference=True +) + +client.query_points( + collection_name="{collection_name}", + query=models.Document( + text="How to bake cookies?", + model="openai/text-embedding-3-large", + options={ + "openai-api-key": "", + "dimensions": 512 + } + ) +) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/rust.md new file mode 100644 index 000000000..65cbd3e90 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/rust.md @@ -0,0 +1,25 @@ +```rust +use qdrant_client::{ + Qdrant, QdrantError, + qdrant::{Document, Query, QueryPointsBuilder, Value}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("").build().unwrap(); + +let mut options = HashMap::::new(); +options.insert("openai-api-key".to_string(), "".into()); +options.insert("dimensions".to_string(), 512.into()); + +client + .query( + QueryPointsBuilder::new("{collection_name}") + .query(Query::new_nearest(Document { + text: "How to bake cookies?".into(), + model: "openai/text-embedding-3-large".into(), + options, + })) + .build(), + ) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/typescript.md new file mode 100644 index 000000000..fda19552b --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-query/typescript.md @@ -0,0 +1,16 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.query("{collection_name}", { + query: { + text: 'How to bake cookies?', + model: 'openai/text-embedding-3-large', + options: { + 'openai-api-key': '', + dimensions: 512, + }, + }, +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/csharp.md new file mode 100644 index 000000000..3fd9856bd --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/csharp.md @@ -0,0 +1,24 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( +host: "xyz-example.qdrant.io", port: 6334, https: true, apiKey: ""); + +await client.UpsertAsync( + collectionName: "{collection_name}", + points: new List + { + new() + { + Id = 1, + Vectors = new Document() + { + Model = "openai/text-embedding-3-large", + Text = "Recipe for baking chocolate chip cookies", + Options = { ["openai-api-key"] = "", ["dimensions"] = 512 }, + }, + }, + } +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/go.md new file mode 100644 index 000000000..ca6c9e1db --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/go.md @@ -0,0 +1,32 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +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", + Options: qdrant.NewValueMap(map[string]any{ + "openai-api-key": "", + "dimensions": 512, + }), + }), + }, + }, +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/http.md index 1e789e97f..50451d744 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/http.md @@ -1,5 +1,5 @@ ```http -PUT /collections//points?wait=true +PUT /collections/{collection_name}/points?wait=true { "points": [ { diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/java.md new file mode 100644 index 000000000..f32c91231 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/java.md @@ -0,0 +1,39 @@ +```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; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey(""), + "dimensions", + value(512))) + .build())) + .build())) + .get(); +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/python.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/python.md new file mode 100644 index 000000000..3363818f8 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/python.md @@ -0,0 +1,26 @@ +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient( + url="https://xyz-example.qdrant.io:6333", + 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": "", + "dimensions": 512 + } + ) + ) + ] +) +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/rust.md new file mode 100644 index 000000000..5d2bf39dd --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/rust.md @@ -0,0 +1,25 @@ +```rust +use qdrant_client::{ + Payload, Qdrant, QdrantError, + qdrant::{Document, PointStruct, UpsertPointsBuilder}, +}; +use std::collections::HashMap; + +let client = Qdrant::from_url("").build()?; +let mut options = HashMap::new(); +options.insert("openai-api-key".to_string(), "".into()); +options.insert("dimensions".to_string(), 512.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?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/typescript.md new file mode 100644 index 000000000..1c3b66918 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/openai-upsert/typescript.md @@ -0,0 +1,21 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.upsert("{collection_name}", { + points: [ + { + id: 1, + vector: { + text: 'Recipe for baking chocolate chip cookies', + model: 'openai/text-embedding-3-large', + options: { + 'openai-api-key': '', + dimensions: 512, + }, + }, + }, + ], +}); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/query/csharp.md b/qdrant-landing/content/documentation/headless/snippets/inference/query/csharp.md new file mode 100644 index 000000000..5933717fd --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/query/csharp.md @@ -0,0 +1,17 @@ +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient( + host: "xyz-example.qdrant.io", + port: 6334, + https: true, + apiKey: "" +); + +await client.QueryAsync( + collectionName: "{collection_name}", + query: new Document() { Model = "qdrant/bm25", Text = "How to bake cookies?" }, + usingVector: "my-bm25-vector" +); +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/query/go.md b/qdrant-landing/content/documentation/headless/snippets/inference/query/go.md new file mode 100644 index 000000000..4528d761d --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/query/go.md @@ -0,0 +1,26 @@ +```go +import ( + "context" + "time" + + "github.com/qdrant/go-client/qdrant" +) + +client, err := qdrant.NewClient(&qdrant.Config{ + Host: "xyz-example.qdrant.io", + Port: 6334, + APIKey: "", + UseTLS: true, +}) + +client.Query(ctx, &qdrant.QueryPoints{ + CollectionName: "{collection_name}", + Query: qdrant.NewQueryNearest( + qdrant.NewVectorInputDocument(&qdrant.Document{ + Model: "qdrant/bm25", + Text: "How to bake cookies?", + }), + ), + Using: qdrant.PtrOf("my-bm25-vector"), +}) +``` \ No newline at end of file diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/query/http.md b/qdrant-landing/content/documentation/headless/snippets/inference/query/http.md index 7715e9e51..0143d71ab 100644 --- a/qdrant-landing/content/documentation/headless/snippets/inference/query/http.md +++ b/qdrant-landing/content/documentation/headless/snippets/inference/query/http.md @@ -1,5 +1,5 @@ ```http -POST /collections//points/query +POST /collections/{collection_name}/points/query { "query": { "text": "How to bake cookies?", diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/query/java.md b/qdrant-landing/content/documentation/headless/snippets/inference/query/java.md new file mode 100644 index 000000000..5ae4d1fb1 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/query/java.md @@ -0,0 +1,27 @@ +```java +import static io.qdrant.client.QueryFactory.nearest; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; +import io.qdrant.client.grpc.Points; +import io.qdrant.client.grpc.Points.Document; + +QdrantClient client = + new QdrantClient( + QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true) + .withApiKey("").build().unwrap(); + +client + .query( + QueryPointsBuilder::new("{collection_name}") + .query(Query::new_nearest(Document { + text: "How to bake cookies?".into(), + model: "qdrant/bm25".into(), + ..Default::default() + })) + .using("my-bm25-vector") + .build(), + ) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/query/typescript.md b/qdrant-landing/content/documentation/headless/snippets/inference/query/typescript.md new file mode 100644 index 000000000..74b28a454 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/query/typescript.md @@ -0,0 +1,13 @@ +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.query("{collection_name}", { + query: { + text: 'How to bake cookies?', + model: 'qdrant/bm25', + }, + using: 'my-bm25-vector', +}); +```