Skip to main content

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-in BaseChatMessageHistory for conversation persistence across sessions
  • SuperLocalMemoryRetrieverBaseRetriever for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_superlocalmemory-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

langchain_superlocalmemory-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_superlocalmemory-0.1.1.tar.gz.

File metadata

File hashes

Hashes for langchain_superlocalmemory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b723b8726dd178c5bf1746f336f8b98e1ddfe9274725dbd450d073ccd575baea
MD5 ae6a7efccdb1cf625e4e2bc53e718fdf
BLAKE2b-256 f1f436fa81e68bbc434a00b9f5092022d43325dbeff5fb4f2b4380f7197f537a

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_superlocalmemory-0.1.1.tar.gz:

Publisher: publish.yml on qualixar/langchain-superlocalmemory

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_superlocalmemory-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_superlocalmemory-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b7804b016d1dd6cd31b4ba28f04cec29ac6f78f3d8d8f07228d4434502450a
MD5 698531fea71f6695524ab7e88740eb47
BLAKE2b-256 87e4b524a985205af86222ecee4476be4a7c9399c5943265c138e81dd6e13990

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_superlocalmemory-0.1.1-py3-none-any.whl:

Publisher: publish.yml on qualixar/langchain-superlocalmemory

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page