A Python package for managing LLM chat conversation history
Project description
LLM Dialog Manager
A Python package for managing AI chat conversation history with support for multiple LLM providers (OpenAI, Anthropic, Google, X.AI) and convenient conversation management features.
Features
- Support for multiple AI providers:
- OpenAI (GPT-3.5, GPT-4)
- Anthropic (Claude)
- Google (Gemini)
- X.AI (Grok)
- Intelligent message role management (system, user, assistant)
- Conversation history tracking and validation
- Load balancing across multiple API keys
- Error handling and retry mechanisms
- Conversation saving and loading
- Memory management options
- Conversation search and indexing
- Rich conversation display options
Installation
pip install llm-dialog-manager
Quick Start
Environment Variables
Create a .env
file in your project root:
# OpenAI
OPENAI_API_KEY_1=your-key-1
OPENAI_API_BASE_1=https://api.openai.com/v1
# Anthropic
ANTHROPIC_API_KEY_1=your-anthropic-key
ANTHROPIC_API_BASE_1=https://api.anthropic.com
# Google
GEMINI_API_KEY=your-gemini-key
# X.AI
XAI_API_KEY=your-x-key
Basic Usage
from llm_dialog_manager import Agent
# Initialize an agent with a specific model
agent = Agent("claude-2.1", memory_enabled=True)
# Add messages and generate responses
agent.add_message("system", "You are a helpful assistant")
agent.add_message("user", "What is the capital of France?")
response = agent.generate_response()
# Save conversation
agent.save_conversation()
Setup Debugging Console
python app.py
# open localhost:8000
https://github.com/user-attachments/assets/5f640029-24e6-44ea-a3a3-02eb3de0d4df
Development
Running Tests
pytest tests/
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please open an issue in the GitHub repository or contact the maintainers.
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
File details
Details for the file llm_dialog_manager-0.2.6.tar.gz
.
File metadata
- Download URL: llm_dialog_manager-0.2.6.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512fa592012faaffcc192ae4d1245072ea9c4baddc997c067f13757d7749029c |
|
MD5 | e50b14a5d238d1e0636af1c36cb84609 |
|
BLAKE2b-256 | f5c6596c781ca4a2a539b306c4664f227d7edbce1aa350c7bea0adc80cfcc656 |
File details
Details for the file llm_dialog_manager-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: llm_dialog_manager-0.2.6-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2970f0244a51f278a17dbd9d65f9b9f9d210f455d2b157ea033d1427c6b93eb8 |
|
MD5 | 41ce0e030864afb8aef8681b424fbd12 |
|
BLAKE2b-256 | da64ba7de45d750a81833e5ecf65bd38fc77ecac6df7fdd4e72c1094d2450ccd |