diff --git a/qdrant-landing/content/documentation/cloud/authentication.md b/qdrant-landing/content/documentation/cloud/authentication.md index 87fd7052d..5a8ee6378 100644 --- a/qdrant-landing/content/documentation/cloud/authentication.md +++ b/qdrant-landing/content/documentation/cloud/authentication.md @@ -56,7 +56,7 @@ const client = new QdrantClient({ using Qdrant.Client; var client = new QdrantClient( - "xyz-example.eu-central.aws.cloud.qdrant.io", + host: "xyz-example.eu-central.aws.cloud.qdrant.io", https: true, apiKey: "" ); diff --git a/qdrant-landing/content/documentation/cloud/quickstart-cloud.md b/qdrant-landing/content/documentation/cloud/quickstart-cloud.md index 67aad0250..bb3bc4fdd 100644 --- a/qdrant-landing/content/documentation/cloud/quickstart-cloud.md +++ b/qdrant-landing/content/documentation/cloud/quickstart-cloud.md @@ -63,7 +63,7 @@ const client = new QdrantClient({ using Qdrant.Client; var client = new QdrantClient( - "xyz-example.eu-central.aws.cloud.qdrant.io", + host: "xyz-example.eu-central.aws.cloud.qdrant.io", https: true, apiKey: "" ); diff --git a/qdrant-landing/content/documentation/concepts/collections.md b/qdrant-landing/content/documentation/concepts/collections.md index 3c86cc685..204c16435 100644 --- a/qdrant-landing/content/documentation/concepts/collections.md +++ b/qdrant-landing/content/documentation/concepts/collections.md @@ -115,8 +115,20 @@ import io.qdrant.client.QdrantGrpcClient; QdrantClient client = new QdrantClient( QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); -client.createCollectionAsync("test_collection", - VectorParams.newBuilder().setDistance(Distance.Dot).setSize(4).build()).get(); +client.createCollectionAsync("{collection_name}", + VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(100).build()).get(); +``` + +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateCollectionAsync( + collectionName: "{collection_name}", + vectorsConfig: new VectorParams { Size = 100, Distance = Distance.Cosine } +); ``` In addition to the required options, you can also specify custom values for the following collection options: @@ -254,6 +266,19 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateCollectionAsync( + collectionName: "{collection_name}", + vectorsConfig: new VectorParams { Size = 100, Distance = Distance.Cosine }, + initFromCollection: "{from_collection_name}" +); +``` + ### Collection with multiple vectors *Available as of v0.10.0* @@ -388,6 +413,25 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateCollectionAsync( + collectionName: "{collection_name}", + vectorsConfig: new VectorParamsMap + { + Map = + { + ["image"] = new VectorParams { Size = 4, Distance = Distance.Dot }, + ["text"] = new VectorParams { Size = 8, Distance = Distance.Cosine }, + } + } +); +``` + For rare use cases, it is possible to create a collection without any vector storage. *Available as of v1.1.1* @@ -516,6 +560,18 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateCollectionAsync( + collectionName: "{collection_name}", + sparseVectorsConfig: ("text", new SparseVectorParams()) +); +``` + Outside of a unique name, there are no required configuration parameters for sparse vectors. The distance function for sparse vectors is always `Dot` and does not need to be specified. @@ -554,6 +610,14 @@ QdrantClient client = client.deleteCollectionAsync("{collection_name}").get(); ``` +```csharp +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteCollectionAsync("{collection_name}"); +``` + ### Update collection parameters Dynamic parameter updates may be helpful, for example, for more efficient initial loading of vectors. @@ -628,6 +692,18 @@ client.updateCollectionAsync( .build()); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.UpdateCollectionAsync( + collectionName: "{collection_name}", + optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 } +); +``` + The following parameters can be updated: * `optimizers_config` - see [optimizer](../optimizer/) for details. @@ -924,6 +1000,40 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.UpdateCollectionAsync( + collectionName: "{collection_name}", + hnswConfig: new HnswConfigDiff { EfConstruct = 123 }, + vectorsConfig: new VectorParamsDiffMap + { + Map = + { + { + "my_vector", + new VectorParamsDiff + { + HnswConfig = new HnswConfigDiff { M = 3, EfConstruct = 123 } + } + } + } + }, + quantizationConfig: new QuantizationConfigDiff + { + Scalar = new ScalarQuantization + { + Type = QuantizationType.Int8, + Quantile = 0.8f, + AlwaysRam = true + } + } +); +``` + ## Collection info Qdrant allows determining the configuration parameters of an existing collection to better understand how the points are @@ -1009,6 +1119,10 @@ client.getCollectionInfoAsync("{collection_name}").get(); +```csharp +await client.GetCollectionInfoAsync("{collection_name}"); +``` + If you insert the vectors into the collection, the `status` field may become `yellow` whilst it is optimizing. It will become `green` once all the points are successfully processed. @@ -1133,6 +1247,10 @@ client.create_alias("example_collection", "production_collection").await?; client.createAliasAsync("production_collection", "example_collection").get(); ``` +```csharp +await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection"); +``` + ### Remove alias ```bash @@ -1193,6 +1311,10 @@ client.delete_alias("production_collection").await?; client.deleteAliasAsync("production_collection").get(); ``` +```csharp +await client.DeleteAliasAsync("production_collection"); +``` + ### Switch collection Multiple alias actions are performed atomically. @@ -1280,6 +1402,10 @@ client.deleteAliasAsync("production_collection").get(); client.createAliasAsync("production_collection", "example_collection").get(); ``` +```csharp +await client.DeleteAliasAsync("production_collection"); +await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection"); +``` ### List collection aliases ```http @@ -1324,6 +1450,14 @@ QdrantClient client = client.listCollectionAliasesAsync("{collection_name}").get(); ``` +```csharp +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListCollectionAliasesAsync("{collection_name}"); +``` + ### List all aliases ```http @@ -1369,6 +1503,14 @@ QdrantClient client = client.listAliasesAsync().get(); ``` +```csharp +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListAliasesAsync(); +``` + ### List all collections ```http @@ -1413,3 +1555,11 @@ QdrantClient client = client.listCollectionsAsync().get(); ``` + +```csharp +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListCollectionsAsync(); +``` diff --git a/qdrant-landing/content/documentation/concepts/explore.md b/qdrant-landing/content/documentation/concepts/explore.md index 68021bd19..8983c9e07 100644 --- a/qdrant-landing/content/documentation/concepts/explore.md +++ b/qdrant-landing/content/documentation/concepts/explore.md @@ -272,6 +272,20 @@ client .get(); ``` +```csharp +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.RecommendAsync( + collectionName: "{collection_name}", + positive: new List { 100, 231 }, + negative: new List { 718 }, + usingVector: "image", + limit: 10 +); +``` + Parameter `using` specifies which stored vectors to use for the recommendation. ### Lookup vectors from another collection @@ -372,6 +386,26 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.RecommendAsync( + collectionName: "{collection_name}", + positive: new List { 100, 231 }, + negative: new List { 718 }, + usingVector: "image", + limit: 10, + lookupFrom: new LookupLocation + { + CollectionName = "{external_collection_name}", + VectorName = "{external_vector_name}", + } +); +``` + Vectors are retrieved from the external collection by ids provided in the `positive` and `negative` lists. These vectors then used to perform the recommendation in the current collection, comparing against the "using" or default vector. @@ -555,6 +589,45 @@ List recommendQueries = client.recommendBatchAsync("{collection_name}", recommendQueries, null).get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +var filter = MatchKeyword("city", "london"); + +await client.RecommendBatchAsync( + collectionName: "{collection_name}", + recommendSearches: new List + { + new() + { + CollectionName = "{collection_name}", + Positive = + { + new List { 100, 231 } + }, + Negative = { new List { 718 } }, + Limit = 3, + Filter = filter, + }, + new() + { + CollectionName = "{collection_name}", + Positive = + { + new List { 200, 67 } + }, + Negative = { new List { 300 } }, + Limit = 3, + Filter = filter, + } + } +); +``` + The result of this API contains one array per recommendation requests. ```json @@ -764,6 +837,35 @@ client .get(); ``` +```csharp +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.DiscoverAsync( + collectionName: "{collection_name}", + target: new TargetVector + { + Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } + }, + context: new List + { + new() + { + Positive = new VectorExample { Id = 100 }, + Negative = new VectorExample { Id = 718 } + }, + new() + { + Positive = new VectorExample { Id = 200 }, + Negative = new VectorExample { Id = 300 } + } + }, + limit: 10 +); +``` +