SuperLocalMemory V3 integration for LangChain — local-first AI memory with mathematical foundations
Project description
langchain-superlocalmemory
LangChain integration for SuperLocalMemory V3 — local-first AI memory with mathematical foundations.
Features
SuperLocalMemoryChatHistory— Drop-inBaseChatMessageHistoryfor conversation persistence across sessionsSuperLocalMemoryRetriever—BaseRetrieverfor RAG-style memory augmentation with 4-channel retrieval- Direct Python API — No subprocess calls, no CLI dependency at runtime
- Privacy-first — All data stays on your device (Mode A: zero cloud)
Installation
pip install langchain-superlocalmemory
Requires SuperLocalMemory V3 to be installed:
pip install "superlocalmemory[search]"
# or
npm install -g superlocalmemory && slm setup
Usage
Chat Message History
from langchain_superlocalmemory import SuperLocalMemoryChatHistory
from langchain_core.runnables.history import RunnableWithMessageHistory
# Create history for a session
history = SuperLocalMemoryChatHistory(session_id="my-project")
# Use with RunnableWithMessageHistory
chain_with_memory = RunnableWithMessageHistory(
chain,
lambda session_id: SuperLocalMemoryChatHistory(session_id=session_id),
input_messages_key="input",
history_messages_key="history",
)
Memory Retriever (RAG)
from langchain_superlocalmemory import SuperLocalMemoryRetriever
retriever = SuperLocalMemoryRetriever(k=5, score_threshold=0.3)
docs = retriever.invoke("authentication middleware patterns")
for doc in docs:
print(f"{doc.page_content} (score: {doc.metadata['score']:.2f})")
Modes
| Mode | Privacy | Performance | Use Case |
|---|---|---|---|
a |
Maximum (zero cloud) | 74.8% LoCoMo | EU AI Act compliant |
b |
High (local Ollama) | Higher | Private + LLM assist |
c |
Standard (cloud LLM) | 87.7% LoCoMo | Maximum accuracy |
# EU AI Act compliant (default)
history = SuperLocalMemoryChatHistory(session_id="s1", mode="a")
# Full power
history = SuperLocalMemoryChatHistory(session_id="s1", mode="c")
Links
License
MIT
Part of Qualixar | Author: Varun Pratap Bhardwaj
Project details
Release history Release notifications | RSS feed
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_superlocalmemory-0.1.1.tar.gz.
File metadata
- Download URL: langchain_superlocalmemory-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b723b8726dd178c5bf1746f336f8b98e1ddfe9274725dbd450d073ccd575baea
|
|
| MD5 |
ae6a7efccdb1cf625e4e2bc53e718fdf
|
|
| BLAKE2b-256 |
f1f436fa81e68bbc434a00b9f5092022d43325dbeff5fb4f2b4380f7197f537a
|
Provenance
The following attestation bundles were made for langchain_superlocalmemory-0.1.1.tar.gz:
Publisher:
publish.yml on qualixar/langchain-superlocalmemory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_superlocalmemory-0.1.1.tar.gz -
Subject digest:
b723b8726dd178c5bf1746f336f8b98e1ddfe9274725dbd450d073ccd575baea - Sigstore transparency entry: 1134169734
- Sigstore integration time:
-
Permalink:
qualixar/langchain-superlocalmemory@4f9dced14bdf69f1b07adccdded88bb9004a0344 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/qualixar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4f9dced14bdf69f1b07adccdded88bb9004a0344 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_superlocalmemory-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_superlocalmemory-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9b7804b016d1dd6cd31b4ba28f04cec29ac6f78f3d8d8f07228d4434502450a
|
|
| MD5 |
698531fea71f6695524ab7e88740eb47
|
|
| BLAKE2b-256 |
87e4b524a985205af86222ecee4476be4a7c9399c5943265c138e81dd6e13990
|
Provenance
The following attestation bundles were made for langchain_superlocalmemory-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on qualixar/langchain-superlocalmemory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_superlocalmemory-0.1.1-py3-none-any.whl -
Subject digest:
d9b7804b016d1dd6cd31b4ba28f04cec29ac6f78f3d8d8f07228d4434502450a - Sigstore transparency entry: 1134169965
- Sigstore integration time:
-
Permalink:
qualixar/langchain-superlocalmemory@4f9dced14bdf69f1b07adccdded88bb9004a0344 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/qualixar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4f9dced14bdf69f1b07adccdded88bb9004a0344 -
Trigger Event:
push
-
Statement type: