dotnet/src/VectorData/PgVector/README.md
This connector uses Postgres to implement Semantic Memory. It requires the pgvector extension to be installed on Postgres to implement vector similarity search.
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.
docker run -d --name postgres-pgvector -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword pgvector/pgvector
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.
See this sample for an example of using the vector store.
For more information on using Postgres as a vector store, see the PostgresVectorStore documentation.
Use the getting started instructions on the Microsoft Leearn site to learn more about using the vector store.