Nexttag.VectorStore.Pgvector 1.0.0

dotnet add package Nexttag.VectorStore.Pgvector --version 1.0.0
                    
NuGet\Install-Package Nexttag.VectorStore.Pgvector -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.Pgvector" 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.Pgvector" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Nexttag.VectorStore.Pgvector" />
                    
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.Pgvector --version 1.0.0
                    
#r "nuget: Nexttag.VectorStore.Pgvector, 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.Pgvector@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.Pgvector&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Nexttag.VectorStore.Pgvector&version=1.0.0
                    
Install as a Cake Tool

Nexttag.VectorStore.Pgvector

Implementação pgvector (PostgreSQL) de Nexttag.VectorStore (IVectorStore). Útil quando você já tem Postgres — evita rodar um banco vetorial separado. O NpgsqlDataSource é construído pelo host; o VectorFilter genérico vira WHERE em jsonb, parametrizado (sem injeção).

dotnet add package Nexttag.VectorStore.Pgvector
using Npgsql;
using Nexttag.VectorStore;
using Nexttag.VectorStore.Pgvector;

// Host constrói o data source — PRECISA habilitar o tipo vector:
var ds = new NpgsqlDataSourceBuilder("Host=...;Database=...").UseVector().Build();
IVectorStore store = new PgVectorStore(ds);

await store.EnsureCollectionAsync("documentos", 3072); // cria extensão + tabela
await store.UpsertAsync("documentos", pontos);
var hits = await store.SearchAsync("documentos", vetor, topK: 5,
    filtro: VectorFilter.In("setor", setoresDoUsuario.Cast<object>().ToList()));

A partir daqui, todo o uso é via IVectorStore — veja o pacote base Nexttag.VectorStore.

Particularidades

  • Pré-requisito: extensão vector no Postgres (o EnsureCollectionAsync roda CREATE EXTENSION IF NOT EXISTS vector — o usuário do banco precisa de permissão).
  • Obrigatório: NpgsqlDataSourceBuilder(...).UseVector() no host (mapeia o tipo vector).
  • Cada coleção é uma tabela (id uuid, embedding vector(dim), payload jsonb). Dimensão fixa na criação.
  • Similaridade por cosseno (<=>); score = 1 - distância. Para escala, crie um índice HNSW/IVFFlat com vector_cosine_ops.
  • Filtros (Eq/In/And/Or) viram WHERE sobre payload->>'campo' (texto), chave e valor parametrizados.
  • DeleteAsync exige filtro (nunca apaga a coleção inteira).

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.

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.0.0 45 6/7/2026