langchain-cairn
LangChain vector store for Cairn, the hybrid search database where a deletion is final.
pip install langchain-cairn
from cairn_db import Client
from langchain_cairn import CairnVectorStore, collection_schema
admin = Client("http://localhost:7200", api_key=ADMIN_KEY)
admin.create_collection("docs", collection_schema(1536, filterable={"source": "Enum"}))
store = CairnVectorStore(Client("http://localhost:7200", api_key=KEY).collection("docs"), embeddings)
store.add_documents(chunks) # chunk.metadata["parent"] = the source document
store.similarity_search("what changed in 2024?", k=4, filter={"source": "handbook"})
store.similarity_search("...", k=4, group_by="parent") # each document once
store.hybrid_search("error E1234", k=4) # vector + BM25, fused
store.as_retriever()
store.delete(parent="handbook.pdf") # the document and all its chunks, everywhere
- Schema.
collection_schemacreates the fields the store needs:- the text and the embedding;
parent;metadata, which holds each document's whole metadata as JSON, so any metadata round-trips;- the
filterablefields, which store the same metadata keys so they can be filtered.
- Filters. Either a plain dict (
{"source": "a"}: every key equals its value), or a Cairn filter ({"field": "page", "gte": 2},and/or/not). - Scores.
similarity_search_with_scorereturns the similarity for Cosine and Dot, and the squared distance for L2.similarity_search_with_relevance_scoresmaps them to [0, 1]. - Deletions. A deletion by ids, by parent or by filter is final. The client carries its consistency token, so later searches never return the deleted documents, on any node.
Metadata
Release files for langchain-cairn 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_cairn-0.3.3.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_cairn-0.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / langchain_cairn-0.3.3.tar.gz
| Download URL | langchain_cairn-0.3.3.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
726909dde94a7284dbab0e7e95f93edccd777e30a73e6d6c7e77ca3e303f23e3
|
|
BLAKE2b-256 checksum How to use checksums |
747c4012f020931106ac46b989be05a147d7a83c17f27482d397c7eef2b84474
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / langchain_cairn-0.3.3-py3-none-any.whl
| Download URL | langchain_cairn-0.3.3-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f15217eff18757e1ed47516b65e5d8e6a2beb8840b607b69538b849bf704aa1c
|
|
BLAKE2b-256 checksum How to use checksums |
826ac155046feaf5b6cc9d65f098f479c373131b0570afb3534e64c0b8f1ff89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency log