A library for managing LLM conversation history
Project description
🐟 MemexLLM
Overview
MemexLLM is a Python library for managing and storing LLM conversations. It provides a flexible and extensible framework for history management, storage, and retrieval of conversations.
Features
- Drop-in Integrations: Add conversation management to your LLM applications with zero code changes using our provider integrations
- Flexible Storage: Choose from memory, SQLite, or bring your own storage backend
- Conversation Management: Organize, retrieve, and manipulate conversation threads with ease
- Memory Management Algorithms: Control conversation context with built-in algorithms (FIFO, summarization, etc.)
- Provider Agnostic: Works with OpenAI, Anthropic, and other LLM providers
- Extensible Architecture: Build custom storage backends and memory management algorithms
Quick Start
Installation
pip install memexllm # Basic installation
pip install memexllm[openai] # With OpenAI support
Basic Usage
from memexllm.storage import MemoryStorage
from memexllm.algorithms import FIFOAlgorithm
from memexllm.core import HistoryManager
# Initialize components
storage = MemoryStorage()
algorithm = FIFOAlgorithm(max_messages=100)
history_manager = HistoryManager(storage=storage, algorithm=algorithm)
# Create a conversation thread
thread = history_manager.create_thread()
# Add messages
history_manager.add_message(
thread_id=thread.id,
content="Hello, how can I help you today?",
role="assistant"
)
Zero-Code-Change Integration
Add conversation management to your OpenAI application with no code changes:
from openai import OpenAI
from memexllm.integrations.openai import patch_openai
# Initialize your OpenAI client as usual
client = OpenAI(api_key="your-api-key")
# Patch the OpenAI client to add conversation management
# This adds persistence without changing your existing code
patch_openai(client)
# Use the client as you normally would - conversations are now managed automatically
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello, who are you?"}]
)
Documentation
For detailed documentation, including:
- Complete API reference
- Advanced usage examples
- Available storage backends
- Contributing guidelines
- Feature roadmap
Visit our documentation at: https://eyenpi.github.io/MemexLLM/
Contributing
We welcome contributions! Please see our Contributing Guide for details on how to get started.
License
This project is licensed under the MIT License.
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
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 memexllm-0.0.5.tar.gz.
File metadata
- Download URL: memexllm-0.0.5.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d0707dda1a8e44df4f84edc998b21bdf2f09a2716405cd97a640d7987cb2991
|
|
| MD5 |
6e81c9fe1bcf6c1f0d9cf08c3e0cbadd
|
|
| BLAKE2b-256 |
eda802c8d7c3050ecf8829bd6905cdf3de941d023b2d7e765400194b7642ea3b
|
Provenance
The following attestation bundles were made for memexllm-0.0.5.tar.gz:
Publisher:
publish.yml on eyenpi/MemexLLM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memexllm-0.0.5.tar.gz -
Subject digest:
6d0707dda1a8e44df4f84edc998b21bdf2f09a2716405cd97a640d7987cb2991 - Sigstore transparency entry: 174112863
- Sigstore integration time:
-
Permalink:
eyenpi/MemexLLM@b7fdce738fa1847473384627dcdc1dca96a1e6a9 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/eyenpi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7fdce738fa1847473384627dcdc1dca96a1e6a9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file memexllm-0.0.5-py3-none-any.whl.
File metadata
- Download URL: memexllm-0.0.5-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5bb8571b11b6f67fca31cb09406ce269e5ad6f6c4a65fe5d7992010720a080c
|
|
| MD5 |
adfe0b33856eba8d2e32ac36f7c9c73d
|
|
| BLAKE2b-256 |
e73515e6e8b9f560c4479d9e051273f9f2187b2f65a45014a62d6c48cb8e2b36
|
Provenance
The following attestation bundles were made for memexllm-0.0.5-py3-none-any.whl:
Publisher:
publish.yml on eyenpi/MemexLLM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memexllm-0.0.5-py3-none-any.whl -
Subject digest:
e5bb8571b11b6f67fca31cb09406ce269e5ad6f6c4a65fe5d7992010720a080c - Sigstore transparency entry: 174112864
- Sigstore integration time:
-
Permalink:
eyenpi/MemexLLM@b7fdce738fa1847473384627dcdc1dca96a1e6a9 -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/eyenpi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7fdce738fa1847473384627dcdc1dca96a1e6a9 -
Trigger Event:
release
-
Statement type: