pgvector/pgvector-go

pgvector support for Go

What it solves

It provides Go language support for the pgvector PostgreSQL extension, allowing developers to store, query, and index vector embeddings within a PostgreSQL database using Go.

How it works

The library acts as a bridge between Go applications and the pgvector extension. It provides specialized types for vectors (including half-precision and sparse vectors) and integration wrappers for popular Go database libraries such as pgx, pg, Bun, Ent, GORM, and sqlx.

Who it’s for

Go developers building AI applications that require vector similarity search, recommendation systems, or RAG (Retrieval-Augmented Generation) workflows using PostgreSQL as their vector store.

Highlights

  • Broad Library Support: Integrates with major Go ORMs and database drivers including GORM, Ent, and pgx.
  • Bespoke Vector Types: Supports standard vectors, half-precision vectors for reduced storage, and sparse vectors for high-dimensional data.
  • Indexing Integration: Simplifies the creation of HNSW and IVFFlat indexes for fast approximate nearest neighbor search.
  • Flexible Distance Metrics: Supports L2 distance, inner product, and cosine distance queries.

Related

  • Project
  • Project
  • Project
  • Project
  • Project