PyMemChat is an open-source chatbot application that utilizes memory management to enhance user interactions. The chatbot remembers previous conversations, allowing for a more personalized and context-aware experience. It leverages the OpenAI API to generate responses based on user input.
- Memory management to retain conversation history.
- Integration with OpenAI's GPT model for generating responses.
- Verbose logging for debugging and monitoring.
PyMemChat/
│
├── chatbot.py # Main chatbot logic and interaction handling.
├── config.py # Configuration settings, including API keys and model parameters.
├── exceptions.py # Custom exception classes for error handling.
├── main.py # Entry point for running the application.
├── memory_manager.py # Handles loading and saving conversation memory.
├── utils.py # Utility functions for logging and processing data.
└── requirements.txt # List of dependencies for the project.
To set up a virtual environment for this project, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/PyMemChat.git cd PyMemChat
-
Create a virtual environment:
python -m venv pymemchat-env
-
Activate the virtual environment:
- On Windows:
pymemchat-env\Scripts\activate
- On macOS/Linux:
source pymemchat-env/bin/activate
- On Windows:
-
Install the required packages:
pip install -r requirements.txt
To run the chatbot, use the following command:
python main.py -v
The -v
flag enables verbose logging for debugging purposes.
-
Initialization: The
main.py
script initializes the application, sets up logging, and creates an instance of theChatbot
class. -
Chatbot Logic: The
chatbot.py
file contains the core logic for handling user interactions. It manages memory through theMemoryManager
class and generates responses using the OpenAI API. -
Memory Management: The
memory_manager.py
file is responsible for loading and saving conversation history to a JSON file, allowing the chatbot to remember past interactions. -
Utilities: The
utils.py
file provides helper functions for logging and processing user input and memory data. -
Configuration: The
config.py
file holds configuration settings, including API keys and model parameters.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under the MIT License - see the LICENSE file for details.