/groqchatbot

GroqChatBot is a high-performance conversational chatbot built using Streamlit and Groq's Language Processing Unit (LPU) 🚀. It leverages the LangChain framework to provide a seamless and interactive chat experience 💬. This chatbot can answer questions ❓, provide information 📚, and engage in friendly conversations with users 😊.

Primary LanguagePython

groqchatbot 🤖

groqchatbot is a high-performance conversational chatbot built using Streamlit and Groq's Language Processing Unit (LPU). It leverages the LangChain framework to provide a seamless and interactive chat experience. This chatbot can answer questions, provide information, and engage in friendly conversations with users.

Features ✨

  • Fast and Efficient: Powered by Groq's LPU for low latency and high performance.
  • Customizable: Modify system prompts and choose from various models.
  • Interactive UI: Built with Streamlit for an intuitive user interface.
  • Conversational Memory: Maintains context with a configurable memory length.

Installation 🛠️

  1. Clone the repository:

    git clone https://github.com/SauravSrivastav/groqchatbot.git
    cd groqchatbot
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Set up your Groq API Key:

    • Sign up on the Groq website and generate an API key.
    • Set the API key as an environment variable:
      export GROQ_API_KEY=your_groq_api_key

Running the Application 🚀

  1. Start the Streamlit app:

    streamlit run app.py
  2. Open your browser and navigate to http://localhost:8501 to interact with the chatbot.

Usage Instructions 📖

  1. Enter your Groq API Key in the sidebar.
  2. Customize the system prompt to guide the chatbot's behavior.
  3. Choose a model from the dropdown menu.
  4. Adjust the conversational memory length using the slider.
  5. Ask a question in the text input box and get responses from the chatbot.

App Screenshots 📸

Search Results

Search Results

Detailed Code Explanation 🧩

Main Application (app.py)

Imports and Setup

startLine: 1
endLine: 17
  • Import necessary libraries and modules.
  • Set up the main function for the Streamlit application.

Sidebar Configuration

startLine: 24
endLine: 32
  • Provide instructions for obtaining the Groq API key.
  • Input field for the user to enter their API key.

Display and Customization

startLine: 35
endLine: 49
  • Display the Groq logo.
  • Set the title and greeting message.
  • Add customization options for system prompts and model selection.

Model Manuals and Memory Configuration

startLine: 67
endLine: 83
  • Provide user manuals for each model.
  • Configure conversational memory length.

Chat Interaction

startLine: 85
endLine: 95
  • Initialize session state for chat history.
  • Save context for previous messages.

Initialize Groq Chat and Handle User Input

startLine: 98
endLine: 143
  • Initialize the Groq LangChain chat object.
  • Construct a chat prompt template.
  • Create a conversation chain and handle user questions.
  • Display chatbot responses and handle errors.

Contributing 🤝

Contributions are welcome! If you'd like to improve groqchatbot, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.

License 📄

This project is licensed under the MIT License. See the LICENSE file for details.

📞 Contact Us

Have questions or suggestions? Reach out to us:


Happy Chatting! 🎉