A Retrieval-Augmented Generation (RAG) Chatbot using Groq, LangChain, Pinecone, and Streamlit
It is a Retrieval-Augmented Generation (RAG) based chatbot designed to give intelligent, contextual answers.
It uses LangChain to manage retrieval and generation, Pinecone for storing and querying vectors, Groq API for fast large language model (LLM) inference, and a Streamlit app for the frontend.
- 🔎 Contextual retrieval of information using Pinecone vector database.
- ⚡ Groq-powered LLMs (like Mixtral, LLaMA 3) generate human-like responses.
- 🔗 LangChain integration for flexible retrieval-generation workflows.
- 🖥️ Streamlit UI for a clean and interactive user experience.
- ⚙️ Fast, intelligent, and memory-efficient design using Groq's low-latency APIs.
- User inputs a query.
- Pinecone retrieves top relevant documents.
- Retrieved context + query is formatted into a custom prompt.
- Groq LLM generates a coherent, helpful answer.
- The Streamlit app displays the response.
- Python 3.10+
- LangChain
- Pinecone
- Groq Python SDK
- Streamlit
- FAISS (optional for local retrieval without Pinecone)
.
├── app.py # Main Streamlit application
├── chatbot/
│ ├── embed_text.py # Text embedding utilities
│ ├── load_data.py # Load and prepare documents
│ ├── groq_setup.py # Load Groq LLM models
│ ├── pinecone_setup.py # Setup and manage Pinecone connection
│ ├── prompt.py # Build custom prompt templates
│ ├── retrieval.py # Retrieve context from Pinecone
│ ├── split_text.py # Text splitting into chunks
│ ├── util.py # Utility functions
├── requirements.txt # Python dependencies
├── .gitignore # Files/folders to ignore by Git
└── .devcontainer/ # Dev container setup for VS Code (optional)
git clone https://github.com/your-username/rag-chatbot.git
cd rag-chatbot
python -m venv myenv
myenv\Scripts\activate # On Windows
source myenv/bin/activate # On Linux/Mac
pip install -r requirements.txt
Create a .env
file inside the chatbot/
folder and add:
GROQ_API_KEY=your-groq-api-key
PINECONE_API_KEY=your-pinecone-api-key
PINECONE_INDEX=your-pinecone-index-name
HUGGINGFACE_API_KEY=your-huggingface-api-key
streamlit run app.py
User: "What are the job opportunities for women in India?"
Bot: "There are several job opportunities for women in India, especially in companies like Google, Accenture, and IBM. Positions like Human Resource Specialist, Software Developer, and Healthcare Professional are quite common."
- Add chat history (memory feature).
- Enable switching between multiple LLMs (Groq, GPT-4, custom LLMs).
- Add authentication for secure document uploads.
- Improve UI/UX with chat animations and avatars.
This project is licensed under the MIT License. Feel free to use, modify, and distribute it!
## Screenshots


