How obinopaul/customgpt works
Project Type & Purpose
• This is a full-stack chatbot application featuring a Streamlit-based frontend for the UI and backend modules that handle language model integrations (OpenAI, HuggingFace, Ollama, DeepSeek), RAG operations, and data processing.
• It integrates with external systems such as Pinecone/Chroma (vector databases) and MongoDB for chat history storage, while also supporting operations like document uploads, web scraping, GitHub issue solving, and research paper retrieval.
File Structure
• Top-level files (e.g., app.py, config.yaml, Dockerfile, README.md) indicate deployment and configuration management.
• The presence of directories such as src, __init__.py files, and separate llm and rag subdirectories suggest a modular codebase. The "src/llm" folder contains files for wrapping around various language models and pipelines. Similarly, "src/rag" includes utility files for document loading, text splitting, vector storage interactions, and web scraping.
• There is also structured data under "lightrag_data" for storing logs and vector-related information, and "references" contains supporting documents.
Main Components & Their Interactions
a. Frontend Component:
• Streamlit UI (app.py) that serves as the primary user interface. This component provides interaction points for selecting models, RAG operations, and displaying chatbot responses.
b. Backend Components:
• LLM Processing Module: Composing various handlers in src/llm (e.g., deepseek.py, huggingface.py, llama.py, openai.py) and the llm_pipeline which coordinates model selection and request handling.
• RAG Module: Found in src/rag, which includes document_loader, text_splitter, vector_store, and web_scraper. This module is responsible for enriching context and supporting retrieval operations.
• Pipeline Orchestration: Files such as src/run_lightrag_pipeline.py and src/run_rag_pipeline.py tie together preprocessing, model execution, and post-processing pipelines.
• Utility Module: src/utils.py contains common utilities shared across modules.
c. Data Storage & External Services:
• Vector Database: Integration with Pinecone (default) as well as support for Chroma for similarity search.
• Chat History Database: MongoDB, where chat histories and other logs are stored.
• External APIs: OpenAI API, HuggingFace API, Pinecone API, GitHub API, etc., with API keys managed via environment configuration (.env).
d. Infrastructure & Deployment:
• Dockerfile and container configurations (.devcontainer) for development and deployment.
• Configuration files such as config.yaml and tailwind.config.js (if a web part is involved) which show additional frontend or design aspects.
• Cloud deployment specifics (vercel.json, render.yaml) used for deployment on platforms like Vercel.
Architectural Patterns & Design Principles
• Modularity: Separate modules for LLM handling, RAG functionalities, and orchestration.
• Separation of Concerns: Clear division between the UI layer (Streamlit), processing layers (LLM and RAG pipelines), and data persistence (MongoDB, vector databases).
• Integration of external APIs/services: API keys and integrations are managed through environment variables to ensure flexibility and scalability.
• Pipeline-based processing: The existence of “run” scripts to trigger either LightRAG or standard RAG implies a clear pipeline execution model.