Groq Chatbot is a conversational AI built using Groq's AI models integrated with Streamlit for a user-friendly interface. The app allows users to interact with the chatbot in a variety of conversational styles (personas), including a friendly assistant, an expert, and a creative problem-solver. The chatbot can remember previous messages and is customizable, making it adaptable for various use cases.
- Customizable Personas: Choose from different conversational styles such as friendly, expert, or creative.
- Conversational Memory: The chatbot can remember past conversations, providing context-aware responses.
- Model Selection: Select from multiple Groq AI models based on your preference.
- User Interface: An intuitive Streamlit-based UI with easy navigation for settings, chat history, and chat statistics.
- Clear Chat History: Users can clear their chat history or start a new topic at any time.
- Chat Statistics: Track the number of messages exchanged and the duration of the conversation.
- Streamlit: A powerful tool for building interactive web applications.
- Groq AI: The backend AI model responsible for generating chatbot responses.
- LangChain: Used for managing conversational memory and integrating the AI model.
- Python: The programming language used to write the application logic.
- Python 3.x
- Groq API Key (obtain from Groq)
- Required libraries (listed below)
-
Clone this repository to your local machine.
git clone https://github.com/arya-io/groq-chatbot.git cd groq-chatbot
-
Install the required libraries:
pip install -r requirements.txt
-
Get your Groq API key from Groq and add it to the code.
Replace
groq_api_key = ""
with your actual API key in the code. -
Run the Streamlit app:
streamlit run app.py
-
Open the app in your browser (usually at http://localhost:8501).
Choose from the available AI models:
llama3-70b-8192
gemma2-9b-it
mixtral-8x7b-32768
Select one of the available conversation styles:
- Default: A friendly, approachable assistant.
- Expert: A knowledgeable, technical assistant.
- Creative: An imaginative and outside-the-box thinker.
Adjust the memory length (how many past messages the AI will remember) to fit your needs.
The chatbot remembers previous messages, helping it provide more context-aware responses.
If you want to change the conversation context, simply click the “New Topic” button to clear the memory.
The project is organized as follows:
groq-chatbot/
│
├── app.py # Main Streamlit application file
├── requirements.txt # List of Python dependencies
└── README.md # Project documentation (you're reading this!)
- app.py: The core of the application that includes all the Streamlit UI and interaction logic.
- requirements.txt: Lists all the required dependencies for the project.
You can easily customize the chatbot by modifying the following:
- Personas: You can add or change the conversational styles in the
get_custom_prompt()
function. - AI Models: Choose or add new models in the model selection dropdown within the sidebar.
- Memory Length: Adjust the slider to control how many messages the chatbot remembers.
We welcome contributions! If you'd like to improve or extend the functionality, feel free to open an issue or submit a pull request.
- Fork the repository.
- Clone your fork to your local machine.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes and commit them (
git commit -m 'Add feature'
). - Push to your fork (
git push origin feature-branch
). - Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Streamlit: For providing an easy-to-use framework for building web applications.
- Groq: For providing powerful AI models that power the chatbot.
- LangChain: For simplifying the memory management and model chaining.