Skip to main content

An integration package connecting Synapse memory and LangChain. Privacy-first, zero API calls, pure Python.

Project description

langchain-synapse

An integration package connecting Synapse memory and LangChain.

Privacy-first AI memory — all data stays local. Zero API calls for storage. Zero external dependencies beyond LangChain and Synapse.

Installation

pip install langchain-synapse

Components

SynapseMemory

Drop-in BaseMemory implementation for any LangChain chain:

from langchain_synapse import SynapseMemory
from synapse import Synapse

syn = Synapse("./agent_memory")
memory = SynapseMemory(synapse=syn)

# Use with any chain
chain = prompt | llm
chain.invoke({"input": "hello"}, config={"memory": memory})

SynapseChatMessageHistory

Persistent chat history with semantic recall:

from langchain_synapse import SynapseChatMessageHistory
from synapse import Synapse

syn = Synapse("./chat_memory")
history = SynapseChatMessageHistory(synapse=syn, session_id="user-123")

history.add_user_message("I love Italian food")
history.add_ai_message("Great! Any favorite dish?")

# Semantic search — find relevant messages, not just recent ones
relevant = history.search("What cuisine do they prefer?")

SynapseRetriever

Use Synapse as a retriever in RAG pipelines:

from langchain_synapse import SynapseRetriever
from synapse import Synapse

syn = Synapse("./knowledge_base")
syn.remember("Python was created by Guido van Rossum")
syn.remember("Rust was created by Graydon Hoare at Mozilla")

retriever = SynapseRetriever(synapse=syn, k=5)

# Use in a RAG chain
from langchain_core.runnables import RunnablePassthrough
chain = (
    {"context": retriever, "question": RunnablePassthrough()}
    | prompt
    | llm
)

Why Synapse?

  • 🔒 Privacy-first: All memory stays on your machine. No cloud. No API calls for storage.
  • 🧠 Neuroscience-inspired: Memory strengthening, decay, and semantic recall — not just vector similarity.
  • ⚡ Zero dependencies: Synapse itself is pure Python with no external dependencies.
  • 📦 Portable: .synapse files can be shared, versioned, and federated across agents.

License

MIT

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_synapse-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

langchain_synapse-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_synapse-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_synapse-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for langchain_synapse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68215a5c0c27572d8c3895a9eae8aa7c0ebfc947d7647779ce2c8f75cd8ba638
MD5 0b55865e7bffc506b62c614ff9bc8562
BLAKE2b-256 d412b815a0f90cd578173f765982fd2f2c3d08c97a1bedfd3d0d5e1e17dc970f

See more details on using hashes here.

File details

Details for the file langchain_synapse-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_synapse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 086fbc3b9ba5178f11fbce70afe0696bcbe203d99da4c2ea50d444a9965c4dc6
MD5 183c2b280ac2f355ebe62b28d29b475e
BLAKE2b-256 ce76fcae2f7439bb2ce49a2f768e8c1d919adab13079c451ffd9e0bf135b8f0b

See more details on using hashes here.

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