A chatbot application leveraging a Retrieval-Augmented Generation (RAG) system, built with a microservices architecture using FastAPI, Docker Compose, and Kubernetes. This project integrates a robust architecture to deliver high-quality, responsive conversational AI.
The system is divided into six primary containers to handle distinct responsibilities effectively:
-
Database Service (Postgres):
- Uses PostgreSQL with the pgVector extension for storing vector data, enabling document retrieval and context reuse.
-
Redis Service:
- A short-term database that caches conversations to enhance the chatbot's response quality by maintaining context.
-
LLM Service:
- Hosts the Large Language Model (e.g., Meta's Ollama) to generate responses in-house, reducing reliance on external LLM providers.
-
Retrieval Service:
- Manages text transformation, embedding generation, and document retrieval. Connects with the database to ensure data safety and adds a layer of protection.
-
AI Service:
- Processes queries using relevant documents retrieved by the retrieval service, and communicates with the LLM model to generate final responses.
-
Orchestrator Service:
- Serves as the API gateway, ensuring seamless integration between services and providing clean public-facing endpoints.
-
UI Service:
- A web application enabling users to upload text files and pose questions. Built to provide a user-friendly interface for interacting with the chatbot.
- Microservices Architecture: Ensures modularity and scalability.
- Dockerized Services: Simplifies deployment and testing across environments.
- RAG System Integration: Combines document retrieval with generative AI for contextually accurate responses.
- LLM Deployment: Supports in-house LLM hosting for cost-efficiency.
- Interactive Web UI: Provides an easy-to-use platform for users to interact with the system.
To get started with the project:
-
Ensure you have Docker and Docker Compose installed on your system.
-
Clone the repository:
git clone mahdjourOussama/Chatbot cd mahdjourOussama/Chatbot
-
Start the services using Docker Compose:
docker-compose up --build
-
For Kubernetes deployment, apply the configurations:
kubectl apply -f ./k8s
./
├── services/
│ ├── orchestrator/
│ ├── ai/
│ ├── retrieval/
│ ├── database/
│ ├── llm/
│ ├── redis/
│ └── ui/
├── k8s/
│ ├── deployment.yml
│ ├── service.yml
├── assets/
│ └── chatbot/
│ └── architecture_diagram.png
└── README.md
└── .env
└── docker-compose.yaml
- Backend Framework: FastAPI
- Frontend Framework: Streamlit
- Database: PostgreSQL with pgVector extension
- Cache: Redis
- Orchestration: Docker Compose, Kubernetes
- AI Frameworks: LangChain, Meta Ollama
Below are some screenshots from the project:
- Building the images
- Containers Created
- Services Logs
- Docker Desktop
- Main Application
- Start Chat with exesting Document
- Chat interface
- Chat Loading response
- Upload Document
- Document Uploaded
Check out our live demo video to see the Chatbot SaaS in action:
Click the image above to watch the demo video.
For questions or support, please reach out via LinkedIn