Qdrant.Client 1.12.0

Prefix Reserved
dotnet add package Qdrant.Client --version 1.12.0                
NuGet\Install-Package Qdrant.Client -Version 1.12.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Qdrant.Client" Version="1.12.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Qdrant.Client --version 1.12.0                
#r "nuget: Qdrant.Client, 1.12.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Qdrant.Client as a Cake Addin
#addin nuget:?package=Qdrant.Client&version=1.12.0

// Install Qdrant.Client as a Cake Tool
#tool nuget:?package=Qdrant.Client&version=1.12.0                

Qdrant .NET SDK

NuGet Release Build

📥 Installation

dotnet add package Qdrant.Client

📖 Documentation

Usage examples are available throughout the Qdrant documentation.

🔌 Getting started

Creating a client

A client can be instantiated with

var client = new QdrantClient("localhost");

which creates a client that will connect to Qdrant on http://localhost:6334.

Internally, the high level client uses a low level gRPC client to interact with Qdrant. Additional constructor overloads provide more control over how the gRPC client is configured. The following example configures a client to use TLS, validating the certificate using its thumbprint, and also configures API key authentication:

var channel = QdrantChannel.ForAddress("https://localhost:6334", new ClientConfiguration
{
    ApiKey = "<api key>",
    CertificateThumbprint = "<certificate thumbprint>"
});
var grpcClient = new QdrantGrpcClient(channel);
var client = new QdrantClient(grpcClient);

[!IMPORTANT] IMPORTANT NOTICE for .NET Framework

.NET Framework has limited supported for gRPC over HTTP/2, but it can be enabled by

  • Configuring qdrant to use TLS, and you must use HTTPS, so you will need to set up server certificate validation
  • Referencing System.Net.Http.WinHttpHandler 6.0.1 or later, and configuring WinHttpHandler as the inner handler for GrpcChannelOptions

The following example configures a client for .NET Framework to use TLS, validating the certificate using its thumbprint, and also configures API key authentication:

var channel = GrpcChannel.ForAddress($"https://localhost:6334", new GrpcChannelOptions
{
  HttpHandler = new WinHttpHandler
  {
    ServerCertificateValidationCallback =
      CertificateValidation.Thumbprint("<certificate thumbprint>")
  }
});
var callInvoker = channel.Intercept(metadata =>
{
  metadata.Add("api-key", "<api key>");
  return metadata;
});

var grpcClient = new QdrantGrpcClient(callInvoker);
var client = new QdrantClient(grpcClient);

Working with collections

Once a client has been created, create a new collection

await client.CreateCollectionAsync("my_collection", 
    new VectorParams { Size = 100, Distance = Distance.Cosine });

Insert vectors into a collection

// generate some vectors
var random = new Random();
var points = Enumerable.Range(1, 100).Select(i => new PointStruct
{
  Id = (ulong)i,
  Vectors = Enumerable.Range(1, 100).Select(_ => (float)random.NextDouble()).ToArray(),
  Payload = 
  { 
    ["color"] = "red", 
    ["rand_number"] = i % 10 
  }
}).ToList();

var updateResult = await client.UpsertAsync("my_collection", points);

Search for similar vectors

var queryVector = Enumerable.Range(1, 100).Select(_ => (float)random.NextDouble()).ToArray();

// return the 5 closest points
var points = await client.SearchAsync(
  "my_collection",
  queryVector,
  limit: 5);

Search for similar vectors with filtering condition

// static import Conditions to easily build filtering
using static Qdrant.Client.Grpc.Conditions;

// return the 5 closest points where rand_number >= 3
var points = await _client.SearchAsync(
  "my_collection",
  queryVector,
  filter: Range("rand_number", new Range { Gte = 3 }),
  limit: 5);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Qdrant.Client:

Package Downloads
Microsoft.SemanticKernel.Connectors.Qdrant

Qdrant connector for Semantic Kernel plugins and semantic memory

BotSharp.Plugin.Qdrant

Package Description

Aspire.Qdrant.Client

A Qdrant client that integrates with Aspire, including logging.

mem0.NET.Qdrant

Package Description

Microsoft.DotNet.Interactive.AI

Support for AI experimentation in notebooks

GitHub repositories (4)

Showing the top 4 popular GitHub repositories that depend on Qdrant.Client:

Repository Stars
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
SciSharp/BotSharp
AI Multi-Agent Framework in .NET
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK from source
Version Downloads Last updated
1.12.0 10,600 10/8/2024
1.11.0 16,213 8/12/2024
1.10.0 21,119 7/1/2024
1.9.0 31,531 4/22/2024
1.8.0 4,893 3/7/2024
1.7.0 9,588 12/8/2023
1.6.0-alpha.1 821 11/8/2023