Nexttag.VectorStore.Qdrant
1.2.0
There is a newer version of this package available.
See the version list below for details.
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" />
<PackageReference Include="Nexttag.VectorStore.Qdrant" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Nexttag.VectorStore.Qdrant&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Nexttag.VectorStore.Qdrant
Provider Qdrant para
Nexttag.VectorStore: implementaIVectorStoresobreQdrantClientvia 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). OQdrantClientusa gRPC por padrão. - Coleções usam distância cosseno — fixa no
EnsureCollectionAsync. Não altere depois. VectorFilter.InviraShould(OR) no Qdrant;EqviraMust.- Pontos usam UUID como id.
VectorIds.ChunkIdgarante ids estáveis entre reindexações. - Para uso completo da
IVectorStore, consulte o README deNexttag.VectorStore.
| Product | Versions 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.
-
net10.0
- Nexttag.VectorStore (>= 1.1.0)
- Qdrant.Client (>= 1.19.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.