A memory management system for large language models
Project description
LLM Memory
一个专为大语言模型设计的记忆管理系统,支持基于重要性的记忆筛选和持久化存储。
安装
pip install llm-memory
使用示例
from llm_memory import CombinedMemory
# 初始化记忆系统
memory = CombinedMemory(
max_size=100,
system_prompt="你是一个助手",
uid="user123"
)
# 添加消息
memory.add_message("user", "你好", importance=1)
memory.add_message("assistant", "你好!有什么我可以帮你的吗?", importance=1)
# 获取上下文
context = memory.get_context()
# 保存到数据库
memory.save_memory_to_db()
特性
- 基于重要性的记忆管理
- 自动保持最近的对话
- 支持数据库持久化
- 可配置的系统提示词
- 依赖文件
requirements.txt:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
llm_memory-0.1.0.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_memory-0.1.0.tar.gz.
File metadata
- Download URL: llm_memory-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e606a3cc7b0b21840bab23cfc1cd506309bf588fd3f5b0e967509693369bf2c
|
|
| MD5 |
73c86d2eaefaf0f4dce45970a7126720
|
|
| BLAKE2b-256 |
af897414310c63ee548ffda81d262754b4f5e18c744a65a7db45088a520e080b
|
File details
Details for the file llm_memory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_memory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a6706304d64c43a29d93864e76510bae870b05a22363d7f0eb9293cb06b31ac
|
|
| MD5 |
d60f7e868a6beac8b209f5d625a356ef
|
|
| BLAKE2b-256 |
9085b5ebac715d5fda15585671523072507ee907404cfd2e3095308ba580a90d
|