mirror of
https://github.com/mtayfur/openwebui-memory-system.git
synced 2026-01-22 23:11:03 +01:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
577f6d6406 | ||
|
|
fe3c47f6e4 | ||
|
|
551b0c571b | ||
|
|
e6e3f7ab99 | ||
|
|
cca8079b94 | ||
|
|
55a8c70bac | ||
|
|
e12aa7b776 | ||
|
|
b5a4872096 | ||
|
|
3f9b4c6d48 | ||
|
|
bb1bd01222 | ||
|
|
189c6d4226 | ||
|
|
7630259ce1 | ||
|
|
a3a627339a | ||
|
|
390747c1d1 | ||
|
|
b6b4c5fde8 | ||
|
|
4328e4b79c | ||
|
|
fcae27e840 | ||
|
|
1f779d86ec | ||
|
|
d07a853aeb | ||
|
|
89399f57cc | ||
|
|
c0bfb3927b | ||
|
|
d05ed8a16e | ||
|
|
7e2209633d | ||
|
|
505c443050 | ||
|
|
0726293446 | ||
|
|
e3709fe677 | ||
|
|
2deba4fb2c | ||
|
|
849dd71a01 | ||
|
|
158f0d1983 | ||
|
|
2db2d3f2c8 | ||
|
|
08155816ff | ||
|
|
840d4c59ca |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
__pycache__/
|
||||
.github/instructions/*
|
||||
.venv/
|
||||
**AGENTS.md
|
||||
tests/
|
||||
22
README.md
22
README.md
@@ -2,6 +2,18 @@
|
||||
|
||||
A long-term memory system that learns from conversations and personalizes responses without requiring external APIs or tokens.
|
||||
|
||||
## ⚠️ Important Notices
|
||||
|
||||
**🔒 Privacy & Data Sharing:**
|
||||
- User messages and stored memories are shared with your configured LLM for memory consolidation and retrieval
|
||||
- If using remote embedding models (like OpenAI text-embedding-3-small), memories will also be sent to those external providers
|
||||
- All data is processed through Open WebUI's built-in models using your existing configuration
|
||||
|
||||
**💰 Cost & Model Requirements:**
|
||||
- The system uses complex prompts and sends relevant memories to the LLM, which increase token usage and costs
|
||||
- Requires public models configured in OpenWebUI - you can use any public model ID from your instance
|
||||
- **Recommended cost-effective models:** `gpt-5-nano`, `gemini-2.5-flash-lite`, `qwen3-instruct`, or your local LLMs
|
||||
|
||||
## Core Features
|
||||
|
||||
**Zero External Dependencies**
|
||||
@@ -21,7 +33,7 @@ Avoids wasting resources on irrelevant messages through two-stage detection:
|
||||
Categories automatically skipped: technical discussions, formatting requests, calculations, translation tasks, proofreading, and non-personal queries.
|
||||
|
||||
**Multi-Layer Caching**
|
||||
Three specialized caches (embeddings, retrieval results, memory lookups) with LRU eviction keep responses fast while managing memory efficiently. Each user gets isolated cache storage.
|
||||
Three specialized caches (embeddings, retrieval, memory) with LRU eviction keep responses fast while managing memory efficiently. Each user gets isolated cache storage.
|
||||
|
||||
**Real-Time Status Updates**
|
||||
Emits progress messages during operations: memory retrieval progress, consolidation status, operation summaries — keeping users informed without overwhelming them.
|
||||
@@ -32,7 +44,7 @@ All prompts and logic work language-agnostically. Stores memories in English but
|
||||
## Model Support
|
||||
|
||||
**LLM Support**
|
||||
Tested with Gemini 2.5 Flash Lite, GPT-4o-mini, Qwen2.5-Instruct, and Mistral-Small. Should work with any model that supports structured outputs.
|
||||
Tested with gemini-2.5-flash-lite, gpt-5-nano, and qwen3-instruct. Should work with any model that supports structured outputs.
|
||||
|
||||
**Embedding Model Support**
|
||||
Uses OpenWebUI's configured embedding model (supports Ollama, OpenAI, Azure OpenAI, and local sentence-transformers). Configure embedding models through OpenWebUI's RAG settings. The memory system automatically uses whatever embedding backend you've configured in OpenWebUI.
|
||||
@@ -54,11 +66,13 @@ Uses OpenWebUI's configured embedding model (supports Ollama, OpenAI, Azure Open
|
||||
## Configuration
|
||||
|
||||
Customize behavior through valves:
|
||||
- **model**: LLM for consolidation and reranking (default: `gemini-2.5-flash-lite`)
|
||||
- **model**: LLM for consolidation and reranking. Set to "Default" to use the current chat model, or specify a model ID to use that specific model
|
||||
- **max_message_chars**: Maximum message length before skipping operations (default: 2500)
|
||||
- **max_memories_returned**: Context injection limit (default: 10)
|
||||
- **semantic_retrieval_threshold**: Minimum similarity score (default: 0.5)
|
||||
- **relaxed_semantic_threshold_multiplier**: Adjusts threshold for consolidation (default: 0.9)
|
||||
- **enable_llm_reranking**: Toggle smart reranking (default: true)
|
||||
- **llm_reranking_trigger_multiplier**: When to activate LLM (default: 0.5 = 50%)
|
||||
- **llm_reranking_trigger_multiplier**: When to activate LLM reranking (default: 0.5 = 50%)
|
||||
|
||||
## Performance Optimizations
|
||||
|
||||
|
||||
25
dev-check.sh
Executable file
25
dev-check.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Development tools script for openwebui-memory-system
|
||||
|
||||
set -e
|
||||
|
||||
if [ -f "./.venv/bin/python" ]; then
|
||||
PYTHON="./.venv/bin/python"
|
||||
elif command -v python3 &> /dev/null; then
|
||||
PYTHON="python3"
|
||||
elif command -v python &> /dev/null; then
|
||||
PYTHON="python"
|
||||
else
|
||||
echo "Python 3 is not installed. Please install Python 3 to proceed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🔧 Running development tools..."
|
||||
|
||||
echo "🎨 Formatting with Black..."
|
||||
$PYTHON -m black .
|
||||
echo "📦 Sorting imports with isort..."
|
||||
$PYTHON -m isort .
|
||||
|
||||
echo "✅ All checks passed!"
|
||||
1052
memory_system.py
1052
memory_system.py
File diff suppressed because it is too large
Load Diff
24
pyproject.toml
Normal file
24
pyproject.toml
Normal file
@@ -0,0 +1,24 @@
|
||||
[tool.black]
|
||||
line-length = 160
|
||||
target-version = ['py38']
|
||||
include = '\.pyi?$'
|
||||
extend-exclude = '''
|
||||
/(
|
||||
\.eggs
|
||||
| \.git
|
||||
| \.hg
|
||||
| \.mypy_cache
|
||||
| \.tox
|
||||
| \.venv
|
||||
| build
|
||||
| dist
|
||||
)/
|
||||
'''
|
||||
|
||||
[tool.isort]
|
||||
line_length = 160
|
||||
multi_line_output = 3
|
||||
include_trailing_comma = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
ensure_newline_before_comments = true
|
||||
@@ -1,5 +1,7 @@
|
||||
aiohttp>=3.12.15
|
||||
pydantic>=2.11.7
|
||||
numpy>=2.0.0
|
||||
open-webui>=0.6.32
|
||||
tiktoken>=0.11.0
|
||||
aiohttp
|
||||
pydantic
|
||||
numpy
|
||||
tiktoken
|
||||
black
|
||||
isort
|
||||
|
||||
Reference in New Issue
Block a user