Skip to main content

A library for managing LLM conversation history

Project description

MemexLLM

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.

Installation

pip install memexllm

Quick 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(metadata={"user": "alice"})

# Add messages
history_manager.add_message(
    thread_id=thread.id,
    content="Hello, how can I help you today?",
    role="assistant"
)

# Retrieve conversation
thread = history_manager.get_thread(thread.id)
for msg in thread.messages:
    print(f"{msg.role}: {msg.content}")

For more examples, check out the examples directory.

Development

Setup

  1. Install pre-commit hooks:
    pip install pre-commit
    pre-commit install
    

This will automatically format your code with black and isort before each commit.

Running Tests

pytest tests/

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.2.tar.gz (7.7 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.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file memexllm-0.0.2.tar.gz.

File metadata

  • Download URL: memexllm-0.0.2.tar.gz
  • Upload date:
  • Size: 7.7 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.2.tar.gz
Algorithm Hash digest
SHA256 f6bb0c62528aed75cd44cc6a8c2297d3b38b167bd963631a05eca7ce0f5b9836
MD5 41c346607011f4eaa42a7d4c63bf13d3
BLAKE2b-256 e3461fff2b9c0a1e55cb5e8b024d9d077760645d0d001a3072a4a7d54af250e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for memexllm-0.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: memexllm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3801b6c16adcc92bde331d317982092d1749cb8900ee76d1c500dd486a852b09
MD5 093ddd79c217817ded4bdec4fdbb66da
BLAKE2b-256 fc0330c27e2afb66b1ad0fe8aea766b94ba246ced35277c6dfbbee88ee96f553

See more details on using hashes here.

Provenance

The following attestation bundles were made for memexllm-0.0.2-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