An interactive chatbot built with Streamlit that uses the Llama 3.3-70b model through the Groq API. The application enables conversations, allows saving them, and provides functionality to retrieve them later.
- Interactive chat interface with Streamlit
- Integration with Groq's Llama 3.3-70b model
- Conversation memory system
- Ability to save and retrieve previous conversations
- Multiple conversation management
- Intuitive user interface with icons and formatting
- Python 3.7+
- Groq account with API key
- Project dependencies:
- streamlit
- groq
- langchain
- python-dotenv
- Clone this repository
- Install dependencies:
pip install streamlit groq langchain python-dotenv
- Create a
.env
file in the root directory and add your Groq API key:
GROQ_API_KEY=your_api_key_here
- Run the application:
streamlit run app.py
- The application will open in your default web browser
- Type your messages in the input field at the bottom
- Use the sidebar to:
- Save current conversations
- Access saved conversations
- Delete old conversations
- Uses LangChain's
ConversationBufferMemory
to maintain conversation context - Message formatting compatible with Groq API
- Automatic title assignment based on first message
- Timestamp included in each saved conversation
- Ability to overwrite existing conversations with the same title
- API key verification
- Model response error management
- Informative error messages for users
- The application uses the
llama-3.3-70b-versatile
model - Temperature is set to 0 for more consistent responses
- Maximum token limit is set to 8000
Contributions are welcome. Please open an issue or pull request for improvement suggestions.
The chatbot implements several key components:
- State Management: Uses Streamlit's session state to maintain conversation history and saved chats
- Message Formatting: Custom function to convert LangChain messages to Groq's required format
- Conversation Titling: Automatic title generation based on the first user message
- Sidebar Controls: Intuitive interface for managing conversations
- Real-time Chat Display: Dynamic message rendering with user and assistant icons
This project is licensed under the MIT License - see the LICENSE file for details.