Skip to main content

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()

特性

  • 基于重要性的记忆管理
  • 自动保持最近的对话
  • 支持数据库持久化
  • 可配置的系统提示词
  1. 依赖文件 requirements.txt

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_memory-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

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

Hashes for llm_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e606a3cc7b0b21840bab23cfc1cd506309bf588fd3f5b0e967509693369bf2c
MD5 73c86d2eaefaf0f4dce45970a7126720
BLAKE2b-256 af897414310c63ee548ffda81d262754b4f5e18c744a65a7db45088a520e080b

See more details on using hashes here.

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

Hashes for llm_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6706304d64c43a29d93864e76510bae870b05a22363d7f0eb9293cb06b31ac
MD5 d60f7e868a6beac8b209f5d625a356ef
BLAKE2b-256 9085b5ebac715d5fda15585671523072507ee907404cfd2e3095308ba580a90d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page