langchain-postgres
View on GitHubLangChain abstractions backed by Postgres Backend
LangChain integration package that implements core LangChain abstractions on Postgres via pgvector. Provides PGVectorStore (sync/async vector search, hybrid search, metadata filtering) and PostgresChatMessageHistory for persisting chat sessions.
Use Cases
Store and query document embeddings for RAG retrievalSemantic similarity search over Postgres dataHybrid keyword+vector search with reciprocal rank fusionPersist LLM chat message history per sessionBuild vector knowledge bases without a dedicated vector DBAsync vector store operations in LangChain appsMetadata-filtered document retrievalMigrate existing PGVector collections to PGVectorStore
Built With
- Language
- Python
- Frameworks
- LangChain · pgvector · SQLAlchemy · psycopg3 · asyncpg · PostgreSQL · pytest · hatchling
Tags
langchain · postgres · pgvector · vector-store · embeddings · hybrid-search · similarity-search · chat-history · rag · persistence · async · sqlalchemy · asyncpg · psycopg · metadata-filtering · python-package