ChatLogger is a Python package written in RUST for managing chat conversations with support for branching dialogue, user management, and integration with language models.
- Manage multiple chat conversations
- Support for branching dialogue
- User management system
- Flask-based web interface example for interacting with chats
pip install chatlogger-db
Real developers learn from examples example-llmui
Here's a basic example of how to use ChatLogger:
from chatlogger import DataBase, Chat, Memory, UserTable
# Initialize the database and user table
db = DataBase("database.bin")
user_table = UserTable(db, "user_table.bin")
# Create a new user
user_table.new_user(userid="userid1", username="laskh")
user = user_table["userid1"]
# Create a new chat
chat_uuid = user.new_chat(prompt_info="Python chatlogger app...")
chat, info, timestamp = user[chat_uuid]
# Add messages to the chat
chat.new_message("write code for Python chatlogger app.", "OK! Tell me more about it so I assist you.")
# Save changes
db.commit()
user_table.commit()
example-llmui includes a Flask-based web interface for interacting with chats. To run the web interface:
python app.py
The DataBase
class manages the storage and retrieval of chat data.
The Chat
class represents a single chat conversation, allowing for branching dialogue.
The Memory
class handles the formatting of chat history for use with language models.
The UserTable
class manages user data and their associated chats.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.