Documentation Index
Fetch the complete documentation index at: https://docs.memwal.ai/llms.txt
Use this file to discover all available pages before exploring further.
with_memwal_langchain and with_memwal_openai wrap an existing LLM client with automatic memory management. Before each call relevant memories are recalled and injected; after each call the user message is analyzed for new facts (fire-and-forget).
Both integrations import their dependency lazily — install only what you use:
LangChain
_agenerate (async) and _generate (sync) on the model instance.
OpenAI SDK
Works with bothopenai.OpenAI (sync) and openai.AsyncOpenAI (async) — the wrapper detects which and patches chat.completions.create accordingly.
The JS-style aliaswithMemWalis exported as a shortcut forwith_memwal_langchain.
What It Does
Before generation:- Reads the last user message
- Runs
recall()against MemWal - Filters by
min_relevance(default0.3) - Injects matching memories as a system message before the last user message
- If
auto_save(defaultTrue), runsanalyze()on the user message fire-and-forget - Extracted facts are stored asynchronously
Options
Both wrappers accept the same keyword arguments:| Option | Default | Description |
|---|---|---|
server_url | http://localhost:8000 | Explicit relayer URL (wins over env) |
env | — | Relayer preset: prod / dev / staging / local |
namespace | "default" | Memory namespace |
max_memories | 5 | Max memories injected per request |
auto_save | True | Auto-save new facts from the conversation |
min_relevance | 0.3 | Minimum similarity (0–1) to include a memory |
debug | False | Verbose logging via the memwal logger |
When To Use Direct SDK Calls Instead
Use directMemWal methods when you need precise control over when memory is stored, which text is analyzed, or how recall results are filtered and displayed.