--- title: Amazon Analytics Chatbot emoji: πŸ“¦ colorFrom: blue colorTo: green sdk: docker app_port: 8501 pinned: false license: mit short_description: RAG + SQL chatbot for Amazon seller analytics (demo data) --- # πŸ“¦ Amazon Analytics Chatbot A Streamlit chatbot (Docker-backed) that answers questions about Amazon seller analytics using **SQL templates** for quantitative queries and **FAISS semantic search (RAG)** for qualitative ones. ## πŸ—οΈ Architecture - **SQL Engine** β€” SQLite + SQLAlchemy, template-based query generation - **RAG** β€” `sentence-transformers/all-MiniLM-L6-v2` embeddings + FAISS index - **LLM** β€” Hugging Face Inference API (default: `Qwen/Qwen2.5-7B-Instruct`) - **UI** β€” Streamlit with a custom dark theme, served via Docker ## πŸ“ Files ``` Dockerfile ← Build & run instructions requirements.txt ← Python deps src/ β”œβ”€β”€ streamlit_app.py ← Streamlit UI (entry point) β”œβ”€β”€ rag_core.py ← RAG + SQL engine β”œβ”€β”€ company_data.db ← SQLite database (demo data) β”œβ”€β”€ rag.index ← FAISS vector index └── rag_chunks.parquet← Chunk metadata ``` ## πŸ”‘ Secrets In **Settings β†’ Variables and secrets β†’ New secret**, add: - `HF_TOKEN` β€” your Hugging Face access token (read scope) Optional: - `HF_MODEL` β€” override default model, e.g. `meta-llama/Llama-3.2-3B-Instruct` ## πŸ’‘ Example Questions - "Total revenue in 2023 Q1" - "Monthly sessions trend last 30 days" - "Top search terms by spend" - "2024 H1 B2B revenue by state" > The included database contains **demo / synthetic data** only. ## πŸ“ License MIT