This Conversational Q&A Chatbot is a Generative AI project built using LangChain (with llama3-8b-8192 model) to enable intelligent, context-aware interactions. The chatbot retains memory of past exchanges, ensuring a seamless and coherent conversation flow.
To incorporate chat history effectively, the project implements two approaches:
-
Chains: A structured method that always retrieves relevant context before generating a response.
-
Agents: A more flexible approach where the LLM dynamically decides when and how to retrieve past information, allowing for multiple retrieval steps if needed.
By leveraging LangChain's retrieval-augmented generation (RAG) capabilities, the chatbot delivers more accurate and contextually relevant answers. This project showcases the power of Generative AI in building interactive, intelligent assistants.
Pre-requisites Before running this Conversational Q&A Chatbot, ensure you have the following dependencies and configurations set up.
1οΈβ£ Environment Setup Ensure you have:
Python 3.8+ installed
A virtual environment (recommended):
bash Copy Edit
python -m venv venv
venv\Scripts\activate
source venv/bin/activate
2οΈβ£ Required Libraries
Install the necessary dependencies:
bash Copy Edit
pip install langchain langchain_community chromadb faiss-cpu openai tiktoken python-dotenv
Additional Libraries (as per your use case):
Vector storage β chromadb (or faiss-cpu as an alternative)
Embeddings β huggingface
LLM Integration β openai, ollama, groq, huggingface_hub
3οΈβ£ Generate and Store API Keys To use Grok AI and Hugging Face, obtain API keys from:
π Grok AI API Key β Grok AI Developer Portal
π Hugging Face API Key β Hugging Face Tokens
Store API Keys Securely
Create a .env file in your project directory and add:
ini Copy Edit
GROQ_API_KEY=your_groq_api_key_here
HUGGINGFACE_API_KEY=your_huggingface_api_key_here
Load API Keys in Code python Copy Edit
from dotenv import load_dotenv import os
load_dotenv()
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
4οΈβ£ Knowledge Base & Data π Dataset for retrieval β PDFs, text files, or structured documents
π§ Preprocessed embeddings for efficient search and retrieval
β Once these pre-requisites are met, you're ready to run the Conversational Q&A Chatbot powered by Generative AI! π