docs: Query API snippets with C# (#1102)

This commit is contained in:
Anush
2024-08-23 22:44:32 +05:30
committed by GitHub
parent f444500ad2
commit d4f07f7e50
8 changed files with 174 additions and 161 deletions
@@ -145,10 +145,12 @@ using static Qdrant.Client.Grpc.Conditions;
var client = new QdrantClient("localhost", 6334);
await client.RecommendAsync(
"{collection_name}",
positive: new ulong[] { 100, 231 },
negative: new ulong[] { 718 },
await client.QueryAsync(
collectionName: "{collection_name}",
query: new RecommendInput {
Positive = { 100, 231 },
Negative = { 718 }
},
filter: MatchKeyword("city", "London"),
limit: 3
);
@@ -292,15 +294,18 @@ client.queryAsync(QueryPoints.newBuilder()
```csharp
using Qdrant.Client;
using Qdrant.Client.Grpc;
var client = new QdrantClient("localhost", 6334);
await client.RecommendAsync(
collectionName: "{collection_name}",
positive: new ulong[] { 100, 231 },
negative: new ulong[] { 718 },
usingVector: "image",
limit: 10
await client.QueryAsync(
collectionName: "{collection_name}",
query: new RecommendInput {
Positive = { 100, 231 },
Negative = { 718 }
},
usingVector: "image",
limit: 10
);
```
@@ -411,13 +416,15 @@ using Qdrant.Client.Grpc;
var client = new QdrantClient("localhost", 6334);
await client.RecommendAsync(
collectionName: "{collection_name}",
positive: new ulong[] { 100, 231 },
negative: new ulong[] { 718 },
await client.QueryAsync(
collectionName: "{collection_name}",
query: new RecommendInput {
Positive = { 100, 231 },
Negative = { 718 }
},
usingVector: "image",
limit: 10,
lookupFrom: new LookupLocation
lookupFrom: new LookupLocation
{
CollectionName = "{external_collection_name}",
VectorName = "{external_vector_name}",
@@ -627,23 +634,27 @@ var client = new QdrantClient("localhost", 6334);
var filter = MatchKeyword("city", "london");
await client.RecommendBatchAsync(
await client.QueryBatchAsync(
collectionName: "{collection_name}",
recommendSearches:
queries:
[
new()
new QueryPoints()
{
CollectionName = "{collection_name}",
Positive = { new PointId[] { 100, 231 } },
Negative = { new PointId[] { 718 } },
Query = new RecommendInput {
Positive = { 100, 231 },
Negative = { 718 },
},
Limit = 3,
Filter = filter,
},
new()
new QueryPoints()
{
CollectionName = "{collection_name}",
Positive = { new PointId[] { 200, 67 } },
Negative = { new PointId[] { 300 } },
Query = new RecommendInput {
Positive = { 200, 67 },
Negative = { 300 },
},
Limit = 3,
Filter = filter,
}
@@ -847,25 +858,23 @@ using Qdrant.Client.Grpc;
var client = new QdrantClient("localhost", 6334);
await client.DiscoverAsync(
await client.QueryAsync(
collectionName: "{collection_name}",
target: new TargetVector
{
Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, }
},
context:
[
new()
{
Positive = new VectorExample { Id = 100 },
Negative = new VectorExample { Id = 718 }
},
new()
{
Positive = new VectorExample { Id = 200 },
Negative = new VectorExample { Id = 300 }
}
],
query: new DiscoverInput {
Target = new float[] { 0.2f, 0.1f, 0.9f, 0.7f },
Context = new ContextInput {
Pairs = {
new ContextInputPair {
Positive = 100,
Negative = 718
},
new ContextInputPair {
Positive = 200,
Negative = 300
},
}
},
},
limit: 10
);
```
@@ -1023,21 +1032,20 @@ using Qdrant.Client.Grpc;
var client = new QdrantClient("localhost", 6334);
await client.DiscoverAsync(
await client.QueryAsync(
collectionName: "{collection_name}",
context:
[
new()
{
Positive = new VectorExample { Id = 100 },
Negative = new VectorExample { Id = 718 }
},
new()
{
Positive = new VectorExample { Id = 200 },
Negative = new VectorExample { Id = 300 }
query: new ContextInput {
Pairs = {
new ContextInputPair {
Positive = 100,
Negative = 718
},
new ContextInputPair {
Positive = 200,
Negative = 300
},
}
],
},
limit: 10
);
```