Skip to main content

Crate synaptic_postgres

Crate synaptic_postgres 

Source
Expand description

PostgreSQL integration for the Synaptic framework.

This crate provides PostgreSQL-backed implementations of Synaptic traits:

  • PgVectorStoreVectorStore using the pgvector extension for cosine-distance similarity search.
  • PgStoreStore for key-value storage with JSONB values and optional full-text search via tsvector.
  • PgCacheLlmCache for caching LLM responses with optional TTL expiration.
  • [PgCheckpointer] — Graph checkpoint persistence (requires checkpointer feature).

§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§

ChatResponse
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 LlmCache trait.
PgCacheConfig
Configuration for PgCache.
PgStore
PostgreSQL-backed implementation of the Store trait.
PgStoreConfig
Configuration for PgStore.
PgVectorConfig
Configuration for a PgVectorStore table.
PgVectorStore
A VectorStore backed 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.
VectorStore
Trait for vector storage backends.