How umaravuri/ecommerce-chatbot works
This is an e-commerce support chatbot that routes questions to policy retrieval, read-only database queries, combined answers, or human escalation. The main flow runs from the user through the chatbot and orchestrator; the orchestrator invokes the selected retrieval/execution stages and generates the answer. The graph preserves the separate SQL-generation capability and index-building path. Some connections are supported only by README descriptions or the source index; unsampled implementation details are not inferred.
Main entry points: orchestrator.py Question orchestrator · router.py Route classifier · index_manager.py Index manager · generator.py Response generator
Components 22
Chat entry
- Chatbot CLI
app/chatbot.py
Routing and response
- Question orchestrator
app/orchestrator/orchestrator.py - Route classifier
app/orchestrator/router.py - Response generator
app/orchestrator/generator.py - Routing and answer prompts
app/orchestrator/prompt.py
Knowledge retrieval
- Policy knowledge base
data/e_commerce_knowledge_base - Markdown loader
app/indexing/loader.py - Index manager
app/indexing/index_manager.py - Embedding and LLM settings
app/indexing/settings.py - Index builder
app/indexing/index_builder.py - Knowledge retriever
app/indexing/query_engine.py
SQL agent
- SQL generator
app/sql_agent/sql_generator.py - SQL generation prompt
app/sql_agent/prompt.py - Schema loader
app/sql_agent/schema_loader.py - SQL safety validator
app/sql_agent/sql_validator.py - SQL executor
app/sql_agent/sql_executor.py
Data sources
- Persisted index
storage - Database connection
app/db/connection.py - MySQL database
Other components
- Customer
- Google Gemini
- Human support
Connections 24
- Customer → Chatbot CLI: asks
readme.txt - Chatbot CLI → Question orchestrator: processes question
app/chatbot.py - Question orchestrator → Route classifier: routes question
app/orchestrator/orchestrator.py - Route classifier → Schema loader: loads schema
app/orchestrator/router.py - Route classifier → Google Gemini: classifies
app/orchestrator/router.py - Route classifier → Routing and answer prompts: uses prompt
app/orchestrator/router.py - Question orchestrator → Knowledge retriever: retrieves policies
app/orchestrator/orchestrator.py - Knowledge retriever → Index manager: gets index
app/indexing/query_engine.py - Index manager → Markdown loader: loads documents
app/indexing/index_manager.py - Index manager → Embedding and LLM settings: configures indexing
app/indexing/index_manager.py - Markdown loader → Policy knowledge base: loads Markdown
readme.txt - Index manager → Persisted index: loads or persists
app/indexing/index_manager.py - Index builder → Embedding and LLM settings: configures index
app/indexing/index_builder.py - Question orchestrator → SQL safety validator: validates SQL
app/orchestrator/orchestrator.py - Question orchestrator → SQL executor: executes SQL
app/orchestrator/orchestrator.py - SQL executor → Database connection: uses engine
app/sql_agent/sql_executor.py - Schema loader → Database connection: inspects schema
app/sql_agent/schema_loader.py - Database connection → MySQL database: connects
- Question orchestrator → Response generator: generates answer
app/orchestrator/orchestrator.py - Response generator → Routing and answer prompts: uses prompt
app/orchestrator/generator.py - Response generator → Google Gemini: generates text
app/orchestrator/generator.py - Question orchestrator → Human support: escalates request
readme.txt - SQL generator → SQL generation prompt: uses prompt
app/sql_agent/sql_generator.py - SQL generator → Schema loader: loads schema
app/sql_agent/sql_generator.py