Expand description
PostgreSQL integration for the Synaptic framework.
This crate provides PostgreSQL-backed implementations of Synaptic traits:
PgVectorStore—VectorStoreusing the pgvector extension for cosine-distance similarity search.PgStore—Storefor key-value storage with JSONB values and optional full-text search viatsvector.PgCache—LlmCachefor caching LLM responses with optional TTL expiration.- [
PgCheckpointer] — Graph checkpoint persistence (requirescheckpointerfeature).
§Quick start
use sqlx::postgres::PgPoolOptions;
use synaptic_postgres::{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§
- Chat
Response - A response from a chat model containing the AI message and optional token usage statistics.
- Document
- A document with content and metadata, used throughout the retrieval pipeline.
- Item
- A stored item in the key-value store.
- PgCache
- PostgreSQL-backed implementation of the
LlmCachetrait. - PgCache
Config - Configuration for
PgCache. - PgStore
- PostgreSQL-backed implementation of the
Storetrait. - PgStore
Config - Configuration for
PgStore. - PgVector
Config - Configuration for a
PgVectorStoretable. - PgVector
Store - A
VectorStorebacked by PostgreSQL with the pgvector extension.
Traits§
- Embeddings
- Trait for embedding text into vectors.
- LlmCache
- Trait for caching LLM responses.
- Store
- Persistent key-value store trait for cross-invocation state.
- Vector
Store - Trait for vector storage backends.