Skip to main content

Module postgres

Module postgres 

Source
Expand description

PostgreSQL memory service implementation with pgvector.

Provides PostgresMemoryService, a MemoryService backed by PostgreSQL with pgvector cosine similarity search and tsvector keyword fallback.

§High-dimensional embeddings (>2000 dims)

pgvector limits both HNSW and IVFFlat indexes to 2000 dimensions on the vector type. When the embedding provider reports more than 2000 dimensions (e.g. Gemini embedding-001 at 3072), the service automatically uses halfvec expression indexing — storing full-precision vector(N) data but indexing and querying via halfvec(N) casts. halfvec supports HNSW up to 4000 dimensions with negligible recall loss and 50% storage savings on the index.

Structs§

PostgresMemoryService
PostgreSQL-backed memory service with optional vector search.
PostgresMemoryServiceBuilder
Builder for PostgresMemoryService with configurable vector index.

Enums§

VectorIndexType
pgvector index algorithm for the embedding column.