How khavanw/customer-support-chatbot works
Main Components
• Frontend: Represents the client-side application (React-based, as indicated by files like App.jsx, main.jsx, and components such as ChatBot).
• Backend: Contains the core server logic. Within this, further break down into major sub-components:
• API Layer: Under backend/src/api (mainly main.py) – handles incoming HTTP requests and routes them.
• Data Processing: In backend/src/data_processing (e.g., node_handler.py, transformation.py) – responsible for processing various input data formats (PDF, Word, Excel) and converting them to a processable JSON format.
• Hybrid Search: Located in backend/src/search with modules like hybrid_search.py and reranking.py – manages both semantic and keyword searches, including invoking the reranking model.
• Language Models Integration: Under backend/src/language_models (with module files such as gemini_llm.py, prompt_template.py) – integrates the Gemini LLM with custom prompt templates.
• Indexing: Potentially handling interactions with the vector database (see backend/src/indexing/qdrant_indexer.py).
• Infrastructure & Deployment:
• Docker and Docker Compose (files like docker-compose.yml, Dockerfiles in both backend & frontend), which encapsulate the service containers and the deployment strategy.
• Healthcheck and environment files support operational readiness.
Relationships and Data Flow
• Within the backend, illustrate the flow starting from the API layer which directs requests to the appropriate modules:
a. Data inputs are processed by the Data Processing module.
b. Processed data is sent to the Hybrid Search module where both semantic and sparse searches take place.
c. The Language Model module (Gemini LLM integration) is then used to generate a conversational response; it may also use results from the search and reranking processes.
• Docker-related components as “Containers,” showing that both frontend and backend are deployed via Docker Compose.
Architectural Patterns and Design Principles
• Use a layered architecture style:
• UI Layer: Frontend React application.
• Service Layer: Backend API (FastAPI) that bridges frontend calls to the underlying business logic.
• Data & Processing Layer: Components handling document processing, search indexing, and language model inference.
• RESTful API interactions and note that containerization (using Docker) encapsulates the individual services.
• Demonstrate how external models (Gemini LLM and embedding models) interact with the backend processing pipeline.
Relevant Technologies and Deployment Aspects
• Frontend Technologies: React, Vite, Tailwind CSS.
• Backend Technologies: Python, FastAPI, Docker, along with the specific AI models (Gemini LLM, LlamaIndex) and embedding libraries.
• Deployment: Docker Compose orchestrates both frontend and backend containers.
• External Tools: Qdrant for vector database functions, and additional dependencies like Sentence-Transformers and transformers packages for NLP.