Go SDK for pgvector, enabling vector storage in Postgres
Top 95.8% on sourcepulse
This Go library provides seamless integration with the pgvector
PostgreSQL extension, enabling developers to efficiently store, query, and index vector embeddings directly within their PostgreSQL databases. It targets Go developers building applications that require similarity search, recommendation systems, or other AI-driven features leveraging vector data.
How It Works
The library acts as a Go driver and ORM integration layer for pgvector
. It serializes Go data structures (slices of float32
) into the vector
or halfvec
types understood by the PostgreSQL extension. It also provides methods to construct SQL queries for vector operations like nearest neighbor search (<->
) and index creation (HNSW, IVFFlat), abstracting away the underlying PostgreSQL data types and functions.
Quick Start & Requirements
go get github.com/pgvector/pgvector-go
pgvector
extension enabled.pgx
, pg
, Bun
, Ent
, GORM
, and sqlx
are available in the README.Highlighted Details
pgx
, pg
, Bun
, Ent
, GORM
, sqlx
.Vector
, HalfVector
, and SparseVector
.Maintenance & Community
The project is actively maintained by the pgvector
team. Contributions are welcomed, with clear guidelines for reporting bugs, fixing issues, and suggesting new features. Development setup instructions and testing procedures are provided.
Licensing & Compatibility
The library is released under the MIT License, permitting commercial use and integration with closed-source applications.
Limitations & Caveats
The library relies on the pgvector
PostgreSQL extension being installed and enabled in the target database. Specific vector dimensions must be declared when creating tables.
1 day ago
1 day