Metadata-Version: 2.3
Name: memexllm
Version: 0.0.2
Summary: A library for managing LLM conversation history
License: MIT
Author: Ali Nabipour
Author-email: alinabipour01@gmail.com
Requires-Python: >=3.10
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
Requires-Dist: typing-extensions (>=4.0.0,<5.0.0)
Project-URL: Repository, https://github.com/eyenpi/memexllm
Description-Content-Type: text/markdown

# MemexLLM

[![CI](https://github.com/eyenpi/memexllm/actions/workflows/ci.yml/badge.svg)](https://github.com/eyenpi/memexllm/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/eyenpi/memexllm/branch/main/graph/badge.svg?token=7C386MR8T9)](https://codecov.io/gh/eyenpi/memexllm)
[![PyPI version](https://badge.fury.io/py/memexllm.svg)](https://badge.fury.io/py/memexllm)
[![Python versions](https://img.shields.io/pypi/pyversions/memexllm.svg)](https://pypi.org/project/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.

## Installation

```bash
pip install memexllm
```

## Quick Usage

```python
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](examples/) directory.

## Development

### Setup

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

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

### Running Tests

```bash
pytest tests/
```

