This is an AI chatbot that leverages pre-trained AI models like gpt-4 as well as the Rwanda Tax documentations in order to answer any user query related to taxes.
# Tax Geek - AI Chatbot
This project is a LangChain-powered chatbot app designed to allow users to ask questions related to tax law. It leverages OpenAI embeddings to process and retrieve contextually relevant answers from a collection of tax law documents using a Retrieval-Augmented Generation (RAG) system. Additionally, LangSmith is used to monitor and debug every user interaction, and the system includes pytest tests for ensuring reliable performance.
## Features
- **RAG System:** Combines retrieval from document embeddings and OpenAI's LLM to provide accurate and context-specific answers.
- **Vector Embeddings:** Automatically processes and stores PDF files into embeddings using FAISS and OpenAI.
- **Interactive UI:** User-friendly interface built with Streamlit for seamless interaction.
- **LangSmith Monitoring:** Tracks and analyzes all interactions to improve the chatbot's performance and reliability.
- **Test Coverage:** Pytest tests ensure the RAG system functions as expected and retrieves accurate results.
## Prerequisites
Before running the application, ensure you have the following:
1. Python 3.8 or later
2. Required Python libraries:
- `streamlit`
- `faiss-cpu`
- `pypdf`
- `langchain`
- `langchain-openai`
- `pytest`
- `langsmith`
## Folder Structure
- **`./documentations`**: Place your tax-related PDF documents here.
- **`app.py`**: Main application file.
- **`create_vectordb.py`**: Creates vectordb with document embeddings and save the vectordb locally.
- **`test_rag.py`**: Contains pytest tests for the RAG system.
## How to Run
1. Clone the repository:
```bash
git clone
github.com
cd Tax-Geek-AI-chatbot
```
2. Create virtual env
```bash
python -m venv venv
```
3. Install the dependencies using:
```bash
pip install -r requirements.txt
```
4. Ensure tax-related PDF documents are in the `documentations` folder.
5. Create `.env` file for credentials
```
OPENAI_API_KEY
LANGSMITH_TRACING=True
LANGSMI …