Nexttag.VectorStore 1.0.0

dotnet add package Nexttag.VectorStore --version 1.0.0
                    
NuGet\Install-Package Nexttag.VectorStore -Version 1.0.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" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nexttag.VectorStore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Nexttag.VectorStore" />
                    
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 --version 1.0.0
                    
#r "nuget: Nexttag.VectorStore, 1.0.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@1.0.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&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Nexttag.VectorStore&version=1.0.0
                    
Install as a Cake Tool

Nexttag.VectorStore

Abstração de banco vetorial para .NET 10. Uma interface (IVectorStore) + um filtro genérico (VectorFilter); as implementações ficam em pacotes separados:

O host escolhe a implementação (por DI/config); o seu código de RAG fala só com IVectorStore e não muda se você trocar Qdrant ↔ pgvector.

Infra genérica: não conhece domínio (setor, ACL, edital). O payload é livre e o filtro (ex.: ACL) é montado pelo host com VectorFilter.


Instalação

# escolha 1 implementação:
dotnet add package Nexttag.VectorStore.Qdrant
# ou
dotnet add package Nexttag.VectorStore.Pgvector

A interface vem transitivamente. No código:

using Nexttag.VectorStore;   // IVectorStore, VectorPoint, VectorHit, VectorFilter, VectorIds

A interface

public interface IVectorStore
{
    Task EnsureCollectionAsync(string colecao, int dimensao, CancellationToken ct = default);
    Task UpsertAsync(string colecao, IReadOnlyList<VectorPoint> pontos, CancellationToken ct = default);
    Task<IReadOnlyList<VectorHit>> SearchAsync(string colecao, ReadOnlyMemory<float> consulta, int topK,
                                               VectorFilter? filtro = null, CancellationToken ct = default);
    Task DeleteAsync(string colecao, VectorFilter filtro, CancellationToken ct = default);
}

record VectorPoint(string Id, ReadOnlyMemory<float> Vector, IReadOnlyDictionary<string, object?> Payload);
record VectorHit(string Id, float Score, IReadOnlyDictionary<string, object?> Payload);

Filtro genérico (VectorFilter)

Cobre o necessário para RAG/ACL; cada backend traduz para o nativo (Qdrant Filter / WHERE SQL):

VectorFilter.Eq("doc_id", id);                     // campo == valor
VectorFilter.In("setor", setoresDoUsuario);        // campo ∈ lista  (ACL!)
VectorFilter.And(f1, f2);                           // E
VectorFilter.Or(f1, f2);                            // OU

Uso ponta a ponta (independe do backend)

IVectorStore store = /* QdrantVectorStore ou PgVectorStore — escolha do host */;

// 1) coleção (dimensão = a do seu modelo de embedding, ex.: 3072)
await store.EnsureCollectionAsync("documentos", dimensao: 3072);

// 2) indexar: monte os pontos com id determinístico + payload do SEU domínio
var pontos = chunks.Select(c => new VectorPoint(
    Id: VectorIds.ChunkId(docId, c.Index),                       // UUIDv5 estável → reindex idempotente
    Vector: c.Vector,
    Payload: new Dictionary<string, object?>
    {
        ["doc_id"] = docId,
        ["chunk_text"] = c.Text,
        ["setor"] = setorId,                                      // ← metadado do domínio (host)
    })).ToList();

await store.DeleteAsync("documentos", VectorFilter.Eq("doc_id", docId)); // limpa antes de reindexar
await store.UpsertAsync("documentos", pontos);

// 3) buscar com ACL (filtro montado pelo host)
VectorFilter? acl = VectorFilter.In("setor", usuario.Setores.Cast<object>().ToList());
IReadOnlyList<VectorHit> hits = await store.SearchAsync("documentos", vetorConsulta, topK: 5, filtro: acl);

foreach (var h in hits)
{
    var trecho = h.Payload["chunk_text"];   // host hidrata / cita
}

Combina com Nexttag.Ai.Embeddings (fatiamento + geração dos vetores).


Trocar de backend

Só muda a construção (no host); o resto do código é idêntico:

// Qdrant
IVectorStore store = new QdrantVectorStore(new QdrantClient("localhost", 6334));

// pgvector
var ds = new NpgsqlDataSourceBuilder(connString).UseVector().Build();
IVectorStore store = new PgVectorStore(ds);

⚠️ A dimensão da coleção precisa bater com o modelo de embedding (gemini-embedding-001 = 3072). Use o mesmo modelo na indexação e na busca.


Licença: uso livre do binário; código-fonte proprietário da Nexttag (ver LICENSE.txt).

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.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Nexttag.VectorStore:

Package Downloads
Nexttag.VectorStore.Qdrant

Implementação Qdrant de Nexttag.VectorStore (IVectorStore). O QdrantClient é construído pelo host; o filtro genérico VectorFilter é traduzido para o filtro nativo do Qdrant.

Nexttag.VectorStore.Pgvector

Implementação pgvector (PostgreSQL) de Nexttag.VectorStore (IVectorStore). O NpgsqlDataSource é construído pelo host (com UseVector()); o filtro genérico VectorFilter vira WHERE em jsonb, parametrizado.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 47 6/7/2026