langchain-serenedb
A LangChain vector store integration for SereneDB
SereneDB speaks the PostgreSQL wire protocol, so this package connects with psycopg3. It maps the integration onto SereneDB's native capabilities:
| Vector Store Search Feature | SereneDB Feature used |
|---|---|
| Vector column | FLOAT[N] |
| Distance ops | <->, <=>, <#>, <+> |
| ANN index | inverted index on the vector column e.g. USING inverted (emb ivf (metric='cosine', ...)) |
| Full-text | inverted index on the text column + BM25(idx.tableoid) |
| Metadata | JSON column, explicit columns |
Installation
pip install langchain-serenedb
Requires Python 3.10+.
Quickstart (engine + table)
from langchain_serenedb import SereneDBEngine, IVFIndex
engine = SereneDBEngine.from_connection_string(
"host=127.0.0.1 port=7890 user=postgres dbname=postgres"
)
# Table only (vector search falls back to an exact scan until an index is built):
engine.init_vectorstore_table(table_name="my_docs", vector_size=768)
# Or create the table and its IVF ANN index in one call, so vector search is
# accelerated from the start:
engine.init_vectorstore_table("my_docs", 768, vector_index=IVFIndex())
# ...or the combined full-text + vector index for hybrid search:
# engine.init_vectorstore_table("my_docs", 768, hybrid_search_config=HybridSearchConfig())
# ... after writing rows, publish them to the inverted index:
engine.refresh_table("my_docs")
Tip: for a large bulk load, SereneDB trains better IVF clusters if you create the index after loading (
store.apply_vector_index(IVFIndex())); creating it up front with the table is the convenient choice for incremental workloads.
Contributing
Building, testing, linting, and running the suite (locally or in Docker Compose) are covered in CONTRIBUTING.md.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_serenedb-26.9.3.tar.gz.
File metadata
- Download URL: langchain_serenedb-26.9.3.tar.gz
- Upload date:
- Size: 211.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46388a63c74f1d643f55f04751112c3e3fe1b84b1597369fd21452da32e98c1b
|
|
| MD5 |
69d67e4718765225df4cd49a3754d726
|
|
| BLAKE2b-256 |
12ef08a6076aa43e6e3d9898ff5d0181c4b0223c9632a3816b30713ccdc1499d
|
Provenance
The following attestation bundles were made for langchain_serenedb-26.9.3.tar.gz:
Publisher:
publish.yml on serenedb/langchain-serenedb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_serenedb-26.9.3.tar.gz -
Subject digest:
46388a63c74f1d643f55f04751112c3e3fe1b84b1597369fd21452da32e98c1b - Sigstore transparency entry: 2697788062
- Sigstore integration time:
-
Permalink:
serenedb/langchain-serenedb@1d0409c50e57132b93270e6bab9d88136884ca4b -
Branch / Tag:
refs/tags/v26.9.3 - Owner: https://github.com/serenedb
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d0409c50e57132b93270e6bab9d88136884ca4b -
Trigger Event:
release
-
Statement type:
File details
Details for the file langchain_serenedb-26.9.3-py3-none-any.whl.
File metadata
- Download URL: langchain_serenedb-26.9.3-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b79b7f4e4d74ebdd475c4213d298bb7df92644edebe59d1c39aaa278010480d0
|
|
| MD5 |
52ce4d3f73a55cecc1b98a852890dd37
|
|
| BLAKE2b-256 |
d570b2fb8df518dd024a52de304dadf7f42176f1b67ef216e7762190705ad719
|
Provenance
The following attestation bundles were made for langchain_serenedb-26.9.3-py3-none-any.whl:
Publisher:
publish.yml on serenedb/langchain-serenedb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_serenedb-26.9.3-py3-none-any.whl -
Subject digest:
b79b7f4e4d74ebdd475c4213d298bb7df92644edebe59d1c39aaa278010480d0 - Sigstore transparency entry: 2697788122
- Sigstore integration time:
-
Permalink:
serenedb/langchain-serenedb@1d0409c50e57132b93270e6bab9d88136884ca4b -
Branch / Tag:
refs/tags/v26.9.3 - Owner: https://github.com/serenedb
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d0409c50e57132b93270e6bab9d88136884ca4b -
Trigger Event:
release
-
Statement type: