This is a simple chatbot application that uses OpenAI's GPT model through the LangChain framework. The chatbot maintains conversation memory and can engage in natural language interactions.
- Uses OpenAI's GPT-3.5-turbo model
- Maintains conversation context using LangChain's memory
- Simple command-line interface
- Configurable temperature for response creativity
-
Install Dependencies
pip install -r requirements.txt
-
Set up OpenAI API Key
- Create a
.envfile in the project root - Add your OpenAI API key:
OPENAI_API_KEY=your_api_key_here - You can get an API key from OpenAI's website
- Create a
-
Run the Chatbot
python chatbot.py
- Start the application using the command above
- Type your message and press Enter
- The AI will respond to your message
- Type 'quit' to exit the conversation
chatbot.py: Main application file containing the chatbot logicrequirements.txt: List of required Python packages.env: Configuration file for API keys (create this file yourself)
- openai: For interacting with OpenAI's API
- langchain: Framework for building LLM applications
- python-dotenv: For loading environment variables
- langchain-openai: OpenAI integration for LangChain