Skip to content

Latest commit

 

History

129 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mem-LLM

PyPI version Python 3.10+ License: MIT

Mem-LLM is a privacy-first Python framework for building memory-enabled AI assistants that run locally.

What's New in v2.5.1

  • Declared the missing pydantic dependency, so graph memory works on a clean install instead of silently disabling itself.
  • Declared the missing python-multipart dependency for the api extra, so mem_llm.api_server imports.

What's New in v2.5.0

  • Added OpenAI-compatible and llama.cpp backend support.
  • Added MemoryRouter for core memory, archival memory, recall, graph context, and KB retrieval.
  • Added temporal graph memory with current and historical graph search.
  • Simplified repeated backend and chat context-building code.

Quick Start

Install

pip install mem-llm

Ollama

from mem_llm import MemAgent

agent = MemAgent(backend="ollama", model="granite4:3b")
agent.set_user("alice")
print(agent.chat("My name is Alice."))
print(agent.chat("What is my name?"))

LM Studio

from mem_llm import MemAgent

agent = MemAgent(backend="lmstudio", model="qwen3.5-2b")
agent.set_user("alice")
print(agent.chat("Summarize Python in one sentence."))

llama.cpp

Start llama.cpp server with an OpenAI-compatible endpoint:

llama-server.exe -m C:\path\to\model.gguf --alias local-model --host 127.0.0.1 --port 8080

Then connect Mem-LLM:

from mem_llm import MemAgent

agent = MemAgent(
    backend="llamacpp",
    model="local-model",
    base_url="http://localhost:8080",
)
agent.set_user("alice")
print(agent.chat("Remember that I prefer concise answers."))

Core Features

  • Persistent memory per user (JSON or SQLite)
  • Multi-backend support (Ollama, LM Studio, OpenAI-compatible APIs, llama.cpp)
  • MemoryRouter with core memory, archival memory, recall, and graph context
  • Temporal graph memory with current and historical lookup
  • Tool calling system (@tool, built-in tools, validation)
  • Streaming responses
  • Knowledge base integration
  • Conversation analytics
  • REST API and Web UI

Repository Layout

  • Memory LLM/ - main package source and release files
  • quickstart/ - step-by-step usage examples & tutorials

Links

License

Mem-LLM is released under the MIT License.

About

Mem-LLM is a Python library for building memory-enabled AI assistants that run entirely on local LLMs, combining persistent multi-user conversation history with configurable knowledge bases, storage backends, and Ollama model support—perfect for privacy-first, production-ready workflows.

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages