This AI Chat Program is a command-line interface (CLI) application that allows users to engage in conversations with an AI assistant specialized in a specific subject. The program uses OpenAI's GPT model and provides features like conversation history, summarization, and persistence.
- Engage in conversations with an AI assistant specialized in a user-defined subject
- Save and load conversation history
- Automatically summarize conversations
- Display a loading spinner for better user experience
- Support for environment variables using .env file
- Python 3.6+
- OpenAI API key
-
Clone this repository:
git clone https://github.com/yourusername/ai-chat-program.git cd ai-chat-program -
Install the required packages:
pip install langchain langchain-openai python-dotenv
-
Create a
.envfile in the project root and add your OpenAI API key:OPENAI_API_KEY=your_api_key_here
Run the program with the following command:
python main.py --subject "your_subject_here"Replace "your_subject_here" with the desired area of expertise for the AI assistant. If not specified, it defaults to "general knowledge".
During the conversation:
- Type your messages and press Enter to send them to the AI.
- Type 'quit', 'exit', or 'q' to end the program.
The program will automatically save the conversation summary when you exit, allowing you to continue the conversation in future sessions.
main.py: The main script containing the AI chat program logic.chat_summaries/: Directory where conversation summaries are stored..env: File for storing environment variables (not included in the repository).
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.