How sam-92/datainsightchatbot works
Project type and purpose
• This is a full-stack data-analysis chatbot built with Streamlit on the front end and Python “agents” on the back end. It interprets natural-language queries into SQL and Python code, runs them against a dataset (PostgreSQL in production or SQLite locally), and returns visualizations to the user. LangChain and OpenAI power the NLP layers.
File structure
• Top level:
• app.py → Streamlit entry point, navigation between pages
• .streamlit/ → Streamlit config for theming and deployment
• Procfile → Heroku deployment
• requirements.txt, pyproject.toml → dependencies
• pages/ → Streamlit “pages” (service overview + chatbot UI)
• subs/ → core backend modules (agent orchestration, DB connectors, prompt templates, styling, visualization functions)
• Key patterns:
• Single-page/front-controller (app.py) dispatches to sub-pages
• Modular “agent” design: separate concerns (SQL agent / Python agent)
• Configurable DB connection for local vs. cloud
README for additional insights
• Confirms architecture:
• Streamlit front end
• LangChain to orchestrate two AI agents (SQL + Python)
• OpenAI’s GPT-4 for NL→SQL/Python
• PostgreSQL (cloud) or SQLite (local) for data
• matplotlib (via Python agent) for plots
• Mentions prompt engineering modules and semantic similarity selector
• Use clear, consistent component labels (e.g., “SQL Agent”, “Python Agent”)
• Blue for frontend components
• Green for backend modules
• Gray for data storage
• Orange for external services
• Yellow for deployment/infrastructure
• Rounded rectangles for microservices or agents