This chatbot is built using an Agentic RAG approach and FastAPI. It leverages the Mixtral-8x7B model with Chroma database and incorporates three tools corresponding to different RAG implementations: FAQ queries, product details queries, and occupation-based insurance product queries.
* The Mixtral-8x7B model is free to run. You may improve the overal performance of the agent using a more powerful LLM such as GPT 3.5 or later.
|
Diagram
|
Sample run demo
|
- Interactive chat interface
- Agentic RAG
- Web-based UI using FastAPI and Jinja2 templates
- Chroma DB
- Python 3.11+
- FastAPI
- LangChain
- LangSmith API key
- NVIDIA AI API key
- Uvicorn
project_root/
│
├── assets/
│ ├── chat_screen.webm
│ └── diagram.jpg
├── data/
│ ├── raw:JSON, CSV
│ └── vector: ChormaDB
├── src/
│ ├── __init__.py
│ ├── agent.py
│ ├── config.py
│ ├── data_classes.py
│ ├── db_creator.py
│ ├── rags.py
│ ├── utils.py
│ └── templates/
│ └── indexes.html
│── tests/
│ ├── __init__.py
│ └── test_rag.py
├── README.md
├── Dockerfile
└── requirements.txt- Clone the repository:
git clone https://github.com/YJonmo/agentic_rag.git
cd agentic_rag- Create a virtual env:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Get an API key from Nvidia website and an API key for LangSmith and place them in your .env file using the following commands:
echo NVIDIA_API_KEY="your-nvidia-api-key" >> .env
echo LANGSMITH_API_KEY="your-langsmith-key" >> .env- Run the following file to create a vector DB from the JSON and the CSV files in the data/raw folde:
python src/db_creator.py- Test the vector DB:
pytestIf there was not error then the vector DB is created inside the .data/vector folder.
- Run the agent locally:
uvicorn src.agent:app --host 0.0.0.0 --port 8000 --reload- Open a web browser at:
http://0.0.0.0:8000/- Build the docker image:
docker build -t agentic_rag .- Run the docker image:
docker run -e NVIDIA_API_KEY="your-nvidia-api-key" -p 8000:8000 agentic_rag
