This project implements a Retrieval-Augmented Generation (RAG) pipeline using FastAPI to create a chat bot that answers questions based on Amazon reviews.
- FastAPI: A modern, fast (high-performance), web framework for building APIs with Python 3.6+.
- RAG Pipeline: Combines retrieval and generation to provide accurate and contextually relevant answers.
- Environment Variables: Uses
dotenv
to manage environment variables. - Logging: Integrated logging for better traceability and debugging.
-
Clone the repository:
git clone https://github.com/rajtulluri/Llama-chat-bot-on-Amazon-reviews-RAG-pipeline.git cd Llama-chat-bot-on-Amazon-reviews-RAG-pipeline
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Run the server:
uvicorn main:app --host 0.0.0.0 --port 8080
-
Send a POST request to
/query
endpoint:- Endpoint:
/query
- Method: POST
- Request Body:
{ "question": "Your question here", "product_name": "Product name here" }
- Endpoint:
main.py
: The main entry point of the application.rag/rag_pipeline.py
: Contains the implementation of the RAG pipeline.templates/request.py
: Defines the request model.templates/response.py
: Defines the response model.