citadeldb-langchain
A LangChain VectorStore and
BaseChatMessageHistory backed by Citadel. Encrypted at rest,
embedded in your process, and deletes that destroy the key, not just the row.
pip install citadeldb-langchain
Vector store
from langchain_openai import OpenAIEmbeddings
from citadeldb_langchain import CitadelVectorStore
store = CitadelVectorStore(OpenAIEmbeddings(), "corpus.cdl", key="your-passphrase")
store.add_texts(["the deploy failed because the disk was full"], ids=["note-1"])
store.similarity_search("why did the release break?", k=1)
retriever = store.as_retriever(search_kwargs={"k": 4})
The width is read from your embedding model on construction, so nothing has to be
configured to match it. Pass dim= to skip that probe.
Adding an id that is already stored replaces it, so re-indexing a document does not duplicate it.
Deletes destroy the key
Every document is sealed under its own key. Deleting destroys that key and then removes the row, so any ciphertext surviving elsewhere stays unreadable.
store.delete(["note-1"]) # named ids
store.clear() # the whole corpus, deliberately
delete() with no ids is a no-op, matching InMemoryVectorStore. Emptying the store is
clear(), because erasure cannot be undone.
Filters
store.similarity_search("...", k=4, filter={"source": "handbook.pdf"})
The filter is evaluated inside the scan, so it narrows candidates before top-k rather than
trimming results after it, and k is k: a filter matching only distant documents still
returns them, however many others outrank them.
Chat history
from citadeldb_langchain import CitadelChatMessageHistory
history = CitadelChatMessageHistory("user-123", "chats.cdl", key="your-passphrase")
history.add_user_message("remember my dog is called Mochi")
history.messages
Messages round-trip through LangChain's own serialization, so tool calls, block content
and additional_kwargs all survive. clear() destroys each message's key, so a cleared
conversation is unreadable.
Use it with RunnableWithMessageHistory the same way as any other history:
from langchain_core.runnables.history import RunnableWithMessageHistory
chain = RunnableWithMessageHistory(
runnable, # your chain
lambda session_id: CitadelChatMessageHistory(session_id, "chats.cdl", key="..."),
input_messages_key="input",
history_messages_key="history",
)
Notes
Citadel is embedded and one process owns the file. A path already open on this thread, under the same passphrase, is shared, so the vector store and the chat history can sit on one encrypted database; construct them on the same thread.
License
Apache-2.0
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 citadeldb_langchain-2.0.0.tar.gz.
File metadata
- Download URL: citadeldb_langchain-2.0.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f06a6091120c15a11ceae595a52dc0d11da94a65a8c67cfadc68bfb66894c672
|
|
| MD5 |
732bcd9008ff3a3dbdebe0d7297eb80c
|
|
| BLAKE2b-256 |
e93d7e8308c70686f4d4b5e4b38f3071c51756c227c660263b816a06c2d6e59c
|
Provenance
The following attestation bundles were made for citadeldb_langchain-2.0.0.tar.gz:
Publisher:
release-langchain.yml on yp3y5akh0v/citadel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
citadeldb_langchain-2.0.0.tar.gz -
Subject digest:
f06a6091120c15a11ceae595a52dc0d11da94a65a8c67cfadc68bfb66894c672 - Sigstore transparency entry: 2516481196
- Sigstore integration time:
-
Permalink:
yp3y5akh0v/citadel@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/yp3y5akh0v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-langchain.yml@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file citadeldb_langchain-2.0.0-py3-none-any.whl.
File metadata
- Download URL: citadeldb_langchain-2.0.0-py3-none-any.whl
- Upload date:
- Size: 8.7 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 |
0be3e432dc01f9ff47d5a276e3a3b8bf6e5e881da34e8d681ad98497d7d5e210
|
|
| MD5 |
5f5240294e0f9ed769bcc34adf088f71
|
|
| BLAKE2b-256 |
e37b69292062456c0eae56ef3f1587e74d2ef6dce7444f85d1c7c72e6e592451
|
Provenance
The following attestation bundles were made for citadeldb_langchain-2.0.0-py3-none-any.whl:
Publisher:
release-langchain.yml on yp3y5akh0v/citadel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
citadeldb_langchain-2.0.0-py3-none-any.whl -
Subject digest:
0be3e432dc01f9ff47d5a276e3a3b8bf6e5e881da34e8d681ad98497d7d5e210 - Sigstore transparency entry: 2516481228
- Sigstore integration time:
-
Permalink:
yp3y5akh0v/citadel@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/yp3y5akh0v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-langchain.yml@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Trigger Event:
push
-
Statement type: