An AI-powered chatbot that ingests product reviews and metadata, stores embeddings in AstraDB/Pinecone, and answers user queries via a FastAPI backend and a simple HTML/JS frontend. It integrates Google embeddings, Groq LLM, and vector search for real-time recommendation and support.
-
Data Ingestion
• Reads CSV of Flipkart product reviews
• Transforms into LangChainDocument
objects -
Vector Store
• Uses Pinecone or AstraDB for embedding storage
• Configurable namespace/collection -
Embedding & LLM
• Googletext-embedding-004
embeddings (dim=768)
• Groq or Google Gemini for answer generation -
Backend
• FastAPI app (main.py
) with/get
endpoint
• CORS-enabled, async endpoints -
Frontend
• Simple HTML/JS (templates/chat.html
)
• Tailored CSS (static/styles.css
) -
Config & Secrets
•.env
for API keys & endpoints
•config/config.yml
for thresholds & parameters
.
├── .env # API keys & endpoints
├── main.py # FastAPI entrypoint
├── requirements.txt
├── setup.py
├── README.md
│
├── config/
│ └── config.yml # Retriever & pipeline settings
│
├── data/
│ └── flipkart\_product\_review\.csv
│
├── data\_ingestion/
│ └── data\_ingest.py # Ingestion pipeline class
│
├── exceptions/
│ └── exception.py # Custom exception classes
│
├── logs/
│ └── logging.py # Logger setup
│
├── models/
│ └── model.py # Pydantic schemas
│
├── prompts/
│ └── prompt.py # Prompt templates
│
├── retrievers/
│ └── retriever.py # Vector store & retriever logic
│
├── static/
│ └── styles.css
│
├── templates/
│ └── chat.html
│
└── utils/
├── config\_loader.py # Loads `config.yml`
└── model\_loader.py # Loads embedding & LLM models
-
Clone & enter project
git clone https://github.com/yourname/customer_support_system.git cd customer_support_system
-
Create & activate virtual environment
python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure
.env
Create a.env
file in the root with:GOOGLE_API_KEY=your_google_key GROQ_API_KEY=your_groq_key PINECONE_API_KEY=your_pinecone_key PINECONE_ENVIRONMENT=your_pinecone_env ASTRA_DB_API_ENDPOINT=your_astra_endpoint ASTRA_DB_APPLICATION_TOKEN=your_astra_token ASTRA_DB_KEYSPACE=your_keyspace
-
Edit
config/config.yml
Define your retriever and ingestion settings:retriever: top_k: 5 score_threshold: 0.1 ingestion: batch_size: 100 collection_name: customer_reviews
-
Start FastAPI
uvicorn main:app --reload --port 8000
-
Open Frontend Navigate to
http://localhost:8000
in your browser. -
Interact • Ask product-related questions • Watch backend logs for ingestion & retrieval details
- Swap vector store: in
retriever.py
, switch betweenAstraDBVectorStore
andPinecone
- Change embedding model: in
model_loader.py
, pick another Google or OpenAI model - Extend prompts: edit
prompts/prompt.py
for different Q&A personalities
- Fork this repo
- Create a feature branch (
git checkout -b feat/your-feature
) - Commit & push (
git commit -m "Add feature"
+git push
) - Open a PR for review
MIT © [Your Name] Feel free to learn, modify, and share!