Expand description
PostgreSQL + pgvector integration for the Synaptic framework.
This crate provides PgVectorStore, an implementation of the
VectorStore trait backed by PostgreSQL with
the pgvector extension. It stores
document content, metadata (as JSONB), and embedding vectors in a single
table, using cosine distance (<=>) for similarity search.
§Quick start
use sqlx::postgres::PgPoolOptions;
use synaptic_pgvector::{PgVectorConfig, PgVectorStore};
let pool = PgPoolOptions::new()
.max_connections(5)
.connect("postgres://user:pass@localhost/mydb")
.await?;
let config = PgVectorConfig::new("documents", 1536);
let store = PgVectorStore::new(pool, config);
store.initialize().await?;Structs§
- Document
- A document with content and metadata, used throughout the retrieval pipeline.
- PgVector
Config - Configuration for a
PgVectorStoretable. - PgVector
Store - A
VectorStorebacked by PostgreSQL with the pgvector extension.
Traits§
- Embeddings
- Trait for embedding text into vectors.
- Vector
Store - Trait for vector storage backends.