CommunityToolkit.VectorData.PgVector
Postgres (with pgvector extension) provider for Microsoft.Extensions.VectorData by the .NET Community Toolkit
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
CommunityToolkit.VectorData.PgVector
This connector uses Postgres to implement Semantic Memory. It requires the pgvector extension to be installed on Postgres to implement vector similarity search.
What is pgvector?
pgvector is an open-source vector similarity search engine for Postgres. It supports exact and approximate nearest neighbor search, L2 distance, inner product, and cosine distance.
How to install the pgvector extension, please refer to its documentation.
This extension is also available for Azure Database for PostgreSQL - Flexible Server and Azure Cosmos DB for PostgreSQL.
Quick start
- To install pgvector using Docker:
docker run -d --name postgres-pgvector -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword pgvector/pgvector
- Create a database and enable pgvector extension on this database
docker exec -it postgres-pgvector psql -U postgres
postgres=# CREATE DATABASE sk_demo;
postgres=# \c sk_demo
sk_demo=# CREATE EXTENSION vector;
Note, "Azure Cosmos DB for PostgreSQL" uses
SELECT CREATE_EXTENSION('vector');to enable the extension.
For more information, see the Microsoft.Extensions.VectorData documentation.
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.