https://www.youtube.com/watch?v=hXF-gVWQTIg
This project is an AI-powered chatbot that provides customer support by answering questions about a judicial circular. The chatbot is designed with a microservices architecture, allowing modular development and scalability. It leverages Retrieval-Augmented Generation (RAG) to retrieve relevant information and generate context-aware responses.
The project consists of the following services:
Frontend: A React application styled with TailwindCSS, providing an interactive user interface to chat with the AI-powered assistant.
Service2 (API Gateway): A FastAPI-based backend that acts as a communication bridge between the frontend and Service3. It also manages user interaction history.
Service3 (Chatbot Engine): Another FastAPI-based backend hosting the chatbot logic. It uses LangChain and OpenAIβs API to retrieve information from the circular and generate accurate responses.
Redis: A Redis server used as a vector database for state management and caching.
Postgres (pgvector): A PostgreSQL server with pgvector extension, used for storing embeddings of the circularβs text to optimize retrieval operations.
This project follows a microservices-based architecture, which simulates a real-world software development environment. Each service is containerized using Docker for improved portability and deployment efficiency.
Rename the .env.example
file to .env
and configure your OpenAI API Key before running the application.
To run the project, ensure you have Docker installed on your system.
Then, execute the following command:
docker-compose up --build
This will start all services as defined in docker-compose.yml
, pulling necessary Docker images, creating containers, and running them together.
The database must be populated with embeddings from the judicial circular before the chatbot can function correctly.
It is recommended to use Anaconda to manage dependencies.
python -m venv venv .\venv\Scripts\activate
Ensure that all required libraries are installed before running the script:
pip install -r requirements.txt
Once the virtual environment is active and dependencies are installed, run the script:
python insert_data.py
This script will:
β Connect to the PostgreSQL (pgvector) database
β Create necessary tables (if they donβt exist)
β Insert the processed embeddings into the vector database