langchain-mengram
LangChain integration for Mengram — AI memory with semantic, episodic, and procedural memory types.
Installation
pip install langchain-mengram
Quick start
from langchain_mengram import MengramRetriever
retriever = MengramRetriever(
api_key="om-...",
user_id="user-123",
)
docs = retriever.invoke("deployment issues")
for doc in docs:
print(doc.metadata["memory_type"], doc.page_content)
What it does
MengramRetriever searches across all three Mengram memory types and returns LangChain Document objects:
- Semantic — facts, entities, and knowledge graph relationships
- Episodic — events, experiences, and their outcomes
- Procedural — workflows, step-by-step procedures, and learned routines
Each document includes metadata["memory_type"] so you can filter or prioritize by type.
Use in a chain
from langchain_mengram import MengramRetriever
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain_core.output_parsers import StrOutputParser
retriever = MengramRetriever(api_key="om-...", user_id="user-123")
llm = ChatOpenAI(model="gpt-4o-mini")
prompt = ChatPromptTemplate.from_messages([
("system", "Use the following memory context to answer:\n\n{context}"),
("human", "{question}"),
])
chain = (
{"context": retriever | format_docs, "question": RunnablePassthrough()}
| prompt
| llm
| StrOutputParser()
)
chain.invoke("What deployment steps did we follow last time?")
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str | required | Mengram API key (starts with om-) |
user_id |
str | "default" |
User to search memories for |
api_url |
str | "https://mengram.io" |
Mengram API base URL |
top_k |
int | 5 |
Max results per memory type |
memory_types |
list | ["semantic", "episodic", "procedural"] |
Which types to search |
Links
Metadata
Release files for langchain-mengram 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_mengram-0.3.0.tar.gz | 5.3 kB | Without provenance | Details for langchain_mengram-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_mengram-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_mengram-0.3.0-py3-none-any.whl |
Total release size: 12.0 kB
Release files / langchain_mengram-0.3.0.tar.gz
| Download URL | langchain_mengram-0.3.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c640e0034dfe38463d8adcdc53f72fa319d1f4e2b7fc215e97df00d49828ed13
|
|
BLAKE2b-256 checksum How to use checksums |
9b0f09c895f9192bad97b38a867e1a52b420c372d02f14c0eb1d4a545953d120
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / langchain_mengram-0.3.0-py3-none-any.whl
| Download URL | langchain_mengram-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91a55af3a9f48e2736e4793b9b8678c0366b8e0c3bcb78950582634532de7472
|
|
BLAKE2b-256 checksum How to use checksums |
457f151f85ac08e7b0062a156596f3f894a58a32259caafdcb96969d04c0f28a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for langchain-mengram 0.3.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.