Skip to main content

A library for managing LLM conversation history

Project description

🐟 MemexLLM

MemexLLM Logo

CI codecov PyPI version Python versions

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memexllm-0.0.6.post1.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

memexllm-0.0.6.post1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file memexllm-0.0.6.post1.tar.gz.

File metadata

  • Download URL: memexllm-0.0.6.post1.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

Hashes for memexllm-0.0.6.post1.tar.gz
Algorithm Hash digest
SHA256 6cf8d2969d8e7749596bbebf6f3114d1c7e174ed15dbf1741a08f4e3110789fb
MD5 d036d7a787ea0ea09a10fddf57180a51
BLAKE2b-256 2636d7132f44b7d49acafdddb84751fcb04febac9fde0ab99a53abcf61b89553

See more details on using hashes here.

Provenance

The following attestation bundles were made for memexllm-0.0.6.post1.tar.gz:

Publisher: publish.yml on eyenpi/MemexLLM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memexllm-0.0.6.post1-py3-none-any.whl.

File metadata

  • Download URL: memexllm-0.0.6.post1-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

Hashes for memexllm-0.0.6.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f21d40d2e5b27c843eb9631fc68f1493e0d03ea6147afa89ab0cffb096d831
MD5 4a55837d48167acb28a34f52bec3fe98
BLAKE2b-256 b5114f464c5cd480e746105efca5d18b5a8b04ee11b27a5905e5f92d3ff01ace

See more details on using hashes here.

Provenance

The following attestation bundles were made for memexllm-0.0.6.post1-py3-none-any.whl:

Publisher: publish.yml on eyenpi/MemexLLM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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