Nexttag.VectorStore.Qdrant 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Nexttag.VectorStore.Qdrant --version 1.2.0
                    
NuGet\Install-Package Nexttag.VectorStore.Qdrant -Version 1.2.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="Nexttag.VectorStore.Qdrant" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nexttag.VectorStore.Qdrant" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Nexttag.VectorStore.Qdrant" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nexttag.VectorStore.Qdrant --version 1.2.0
                    
#r "nuget: Nexttag.VectorStore.Qdrant, 1.2.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.
#:package Nexttag.VectorStore.Qdrant@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nexttag.VectorStore.Qdrant&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Nexttag.VectorStore.Qdrant&version=1.2.0
                    
Install as a Cake Tool

Nexttag.VectorStore.Qdrant

Provider Qdrant para Nexttag.VectorStore: implementa IVectorStore sobre QdrantClient via gRPC.

Instalar

dotnet add package Nexttag.VectorStore.Qdrant

Requer .NET 10. Depende de: Nexttag.VectorStore, Qdrant.Client 1.12.0.

Registrar (Program.cs)

using Qdrant.Client;
using Nexttag.VectorStore;
using Nexttag.VectorStore.Qdrant;

// Host constrói o QdrantClient (responsabilidade do host: host, porta, TLS, api-key)
services.AddSingleton(_ => new QdrantClient(
    host:   "192.168.0.172",
    port:   6334,             // gRPC (padrão: 6334)
    https:  false,
    apiKey: null));           // definir se o Qdrant exigir autenticação

services.AddSingleton<IVectorStore>(sp =>
    new QdrantVectorStore(sp.GetRequiredService<QdrantClient>()));

Configurar

Sem seção de appsettings nesta lib. Configure os valores diretamente no construtor de QdrantClient:

Parâmetro QdrantClient Descrição Padrão Nexttag
host Endereço do Qdrant 192.168.0.172 (NAS local)
port Porta gRPC 6334
https TLS ligado/desligado false (rede local)
apiKey API key (se Qdrant exigir) null

Usar

Criar coleção e indexar

IVectorStore store = new QdrantVectorStore(qdrantClient);

// Cria a coleção (idempotente; distância cosine fixa)
await store.EnsureCollectionAsync("documentos", dimensao: 3072);

// Indexar pontos
var pontos = chunks.Select((c, i) => new VectorPoint(
    Id:      VectorIds.ChunkId(docId, i),         // UUIDv5 determinístico
    Vector:  c.EmbeddingVector,
    Payload: new Dictionary<string, object?>
    {
        ["doc_id"]     = docId,
        ["chunk_text"] = c.Text,
        ["setor"]      = "financeiro",
    })).ToList();

await store.UpsertAsync("documentos", pontos);

Buscar com filtro

var hits = await store.SearchAsync(
    "documentos",
    vetorDaConsulta,
    topK: 5,
    filtro: VectorFilter.In("setor", new object[] { "financeiro", "ti" }));

foreach (var h in hits)
    Console.WriteLine($"[{h.Score:F3}] {h.Payload["chunk_text"]}");

Deletar pontos de um documento

await store.DeleteAsync("documentos", VectorFilter.Eq("doc_id", docId));

Receitas

Qdrant com autenticação (produção)

services.AddSingleton(_ => new QdrantClient(
    host:   "qdrant.producao.com",
    port:   6334,
    https:  true,
    apiKey: Environment.GetEnvironmentVariable("QDRANT_API_KEY")));
services.AddSingleton<IVectorStore>(sp =>
    new QdrantVectorStore(sp.GetRequiredService<QdrantClient>()));

Pipeline RAG completo com Nexttag.Rag

// Registrar stack de IA
services.AddSingleton<IEmbeddingGenerator<string, Embedding<float>>>(sp =>
    openAiClient.GetEmbeddingClient("text-embedding-3-large").AsIEmbeddingGenerator());
services.AddSingleton<IVectorStore>(sp =>
    new QdrantVectorStore(sp.GetRequiredService<QdrantClient>()));

// Retriever na camada de aplicação
IRetriever retriever = new VectorRetriever(embeddings, store, ["documentos"]);
var trechos = await retriever.RetrieveAsync("qual o prazo?", topK: 5,
    filter: VectorFilter.Eq("kb_id", kbId));

Filtro composto (ACL + kb_id)

var filtro = VectorFilter.And(
    VectorFilter.Eq("kb_id", kbId),
    VectorFilter.In("setor", usuario.Setores.Cast<object>().ToList()));

var hits = await store.SearchAsync("documentos", vetor, topK: 5, filtro: filtro);

Notas

  • Pré-requisito de infra: Qdrant rodando e acessível. No ambiente Nexttag: 192.168.0.172:6333 (HTTP) / 192.168.0.172:6334 (gRPC). O QdrantClient usa gRPC por padrão.
  • Coleções usam distância cosseno — fixa no EnsureCollectionAsync. Não altere depois.
  • VectorFilter.In vira Should (OR) no Qdrant; Eq vira Must.
  • Pontos usam UUID como id. VectorIds.ChunkId garante ids estáveis entre reindexações.
  • Para uso completo da IVectorStore, consulte o README de Nexttag.VectorStore.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 117 10/31/2026
1.2.0 108 10/8/2026
1.0.0 302 6/7/2026