How amanr24/databot works
Project type and purpose
• DATAbot is a full-stack, single-process Streamlit application that exposes a chat interface (“Chatbot Mode”) and a separate “Dashboard Mode.”
• It implements a multi-agent orchestration layer to handle EDA, visualization, SQL query generation, PDF question-answering, voice I/O, and an AutoML/forecasting dashboard.
File structure
Top‐level directories/files:
• src/app.py – the Streamlit entrypoint (the “frontend”)
• src/multiagent_router.py – the core dispatcher that receives user requests and routes them to one of several agents
• src/agents/… – three agent classes:
• eda_database_agent.py (EDA narrative & chart agent)
• sql_database_agent.py (SQL generation & execution agent)
• pdf_database_agent.py (RAG-over-PDF agent)
• src/tools/… – low-level utilities and wrappers (Sweetviz/Plotly/Matplotlib/Seaborn, SQLAlchemy, Whisper STT, browser TTS, Python code runner, dashboard integration)
• requiements.txt – Python dependencies including Streamlit, LangChain, Groq SDK, PyCaret, Prophet, Sweetviz, Whisper, etc.
• images/ & videos/ – static assets for documentation
Key insights from README
• Streamlit UI for two modes: Chatbot & Dashboard
• SQLite for persisting uploaded CSVs
• LangChain + Groq’s LLM as the “brain” behind all agents
• Five major tool-based capabilities: EDA summaries, chart generation, SQL, PDF RAG, voice I/O
• Dashboard mode uses PyCaret (AutoML), What-If simulation, Prophet (time-series), plus data-cleaning utilities
Main components
a. Frontend/UI
• Streamlit App (src/app.py)
• Mode toggle (Chatbot vs. Dashboard)
b. Orchestration Layer
• MultiAgent Router (src/multiagent_router.py)
c. Agents
• EDA Agent
• SQL Agent
• PDF Agent
d. Tools / Worker Modules
• EDA & Visualization (eda.py + Sweetviz + Plotly/Matplotlib/Seaborn)
• SQL utilities (sql.py + SQLAlchemy)
• DataFrame helpers (dataframe.py)
• Python code execution (python_run.py)
• Voice translation (voice_translator.py + Whisper)
• TTS rendering (tts_renderer.py)
• Dashboard integration (dashboard.py + PyCaret + Prophet)
e. Persistence & Storage
• SQLite database (local file) for CSV ingestion
• Filesystem storage for uploaded PDFs & generated reports
f. External Services
• Groq LLM API (via LangChain)
• Optional browser audio APIs for TTS playback
Relationships and data flows
• Streamlit UI → (user request) → MultiAgent Router
• Router → selects an Agent based on request type
• Agent → calls one or more Tools
• Tools → interact with Database / File System / External LLM API
• Agent → returns processed results (text, charts, SQL results, audio data) → Router → UI
• Dashboard tools bypass the router and feed directly into dashboard.py components
Architectural patterns & design principles
• Multi-agent orchestration (plugin-style agents extend a common interface)
• Tool abstraction for external calls (separation of concerns between agent logic and low-level operations)
• Monolithic service but modularized into layers (UI → Router → Agents → Tools → Persistence/External)
• Event-driven flow with directional data streams
Technologies & frameworks to annotate
• Streamlit (UI layer)
• LangChain + Groq SDK (LLM orchestration)
• SQLAlchemy + SQLite (data persistence)
• Sweetviz, Plotly, Matplotlib, Seaborn (visualization)
• PyCaret, Prophet (dashboard analytics)
• Whisper (STT) + browser TTS (voice I/O)
• Python subprocess or eval (python_run tool)