Skip to main content

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

langchain_serenedb-26.9.3.tar.gz (211.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_serenedb-26.9.3-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

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

Hashes for langchain_serenedb-26.9.3.tar.gz
Algorithm Hash digest
SHA256 46388a63c74f1d643f55f04751112c3e3fe1b84b1597369fd21452da32e98c1b
MD5 69d67e4718765225df4cd49a3754d726
BLAKE2b-256 12ef08a6076aa43e6e3d9898ff5d0181c4b0223c9632a3816b30713ccdc1499d

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_serenedb-26.9.3.tar.gz:

Publisher: publish.yml on serenedb/langchain-serenedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_serenedb-26.9.3-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_serenedb-26.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b79b7f4e4d74ebdd475c4213d298bb7df92644edebe59d1c39aaa278010480d0
MD5 52ce4d3f73a55cecc1b98a852890dd37
BLAKE2b-256 d570b2fb8df518dd024a52de304dadf7f42176f1b67ef216e7762190705ad719

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_serenedb-26.9.3-py3-none-any.whl:

Publisher: publish.yml on serenedb/langchain-serenedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

26.9.3 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page