Skip to main content

Crate synaptic_pgvector

Crate synaptic_pgvector 

Source
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.
PgVectorConfig
Configuration for a PgVectorStore table.
PgVectorStore
A VectorStore backed by PostgreSQL with the pgvector extension.

Traits§

Embeddings
Trait for embedding text into vectors.
VectorStore
Trait for vector storage backends.