Spaces:
Running
Running
| title: ThoughtSpot Demo Builder | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: gradio | |
| sdk_version: "4.44.1" | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| python_version: "3.11" | |
| # DemoPrep β AI-Powered ThoughtSpot Demo Builder | |
| A Gradio application that generates and deploys complete ThoughtSpot demo environments end to end β company research, an LLM-authored data blueprint, deterministic data generation, a Snowflake schema + data load, and a ThoughtSpot semantic model and liveboard. | |
| > **Deployed on Hugging Face Spaces.** `app.py` is the entry point. See [DEPLOYMENT.md](DEPLOYMENT.md) for setup. | |
| ## π₯οΈ The interface | |
| The app is a **tabbed Gradio UI**, and the **App tab is the primary way to build a demo**: fill in a short form and press **GO**, and the full pipeline runs automatically with live progress. | |
| > **Naming note:** the whole application lives in **`chat_interface.py`** β that name is *historical*. It is **not** just a chat interface; that single file hosts every tab (App, Chat, Admin, Settings, Run History, β¦), and the **App tab is the main path**. A **Chat tab** offers an alternative conversational flow that runs the same pipeline. `app.py` simply configures and launches this app. | |
| ## π Features | |
| - **AI-powered research** β researches the company and industry with an LLM | |
| - **Single blueprint pipeline** β one path, no keyword routing or fallback: research β LLM-authored `DemoBlueprint` β deterministic engine β validation β derived DDL β load | |
| - **Realistic data** β bounded/related measures (a part never exceeds its whole, rates stay β€ 1, prices are stable per entity) plus planted, discoverable "Demo to Win" insights the validator proves are visible | |
| - **ThoughtSpot integration** β deploys the connection, tables, semantic model, and an enhanced liveboard | |
| - **Interactive UI** β tabbed Gradio app with real-time progress | |
| ## π οΈ Tech Stack | |
| - **Frontend**: Gradio (Python web UI) | |
| - **Backend**: Python 3.11 | |
| - **Database**: Snowflake (keypair auth) | |
| - **Analytics**: ThoughtSpot (per-environment trusted auth) | |
| - **AI**: multiple LLM providers (OpenAI and Anthropic/Claude), routed via `llm_config.py` | |
| - **Settings**: Supabase (admin + per-user settings) | |
| ## π Prerequisites | |
| - Python 3.11 | |
| - Snowflake account (keypair configured) | |
| - ThoughtSpot Cloud account | |
| - An LLM API key (OpenAI and/or Anthropic) | |
| - Supabase project (settings storage) | |
| ## π Quick Start | |
| 1. **Clone the repository** | |
| ```bash | |
| git clone <repo-url> | |
| cd demoprep | |
| ``` | |
| 2. **Set up a virtual environment** | |
| ```bash | |
| python -m venv .venv | |
| source .venv/bin/activate # Windows: .venv\Scripts\activate | |
| ``` | |
| 3. **Install dependencies** | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 4. **Configure bootstrap environment variables** (see Configuration) | |
| ```bash | |
| cp .env.example .env | |
| # edit .env | |
| ``` | |
| 5. **Run the application** | |
| ```bash | |
| python app.py | |
| ``` | |
| `app.py` launches the full Gradio app defined in `chat_interface.py`. | |
| 6. **Open your browser** | |
| Navigate to `http://localhost:7860` and use the **App** tab. | |
| ## βοΈ Configuration | |
| `.env` holds only the **bootstrap** secrets needed to start the app and reach Supabase and the LLM providers. All other credentials β the Snowflake keypair and the ThoughtSpot **per-environment trusted-auth keys** β live in **Supabase admin settings** and are loaded at runtime. | |
| ```env | |
| # Supabase (settings storage) | |
| SUPABASE_URL=... | |
| SUPABASE_ANON_KEY=... | |
| # LLM providers | |
| OPENAI_API_KEY=... | |
| GOOGLE_API_KEY=... # optional (Gemini) | |
| # Slack deployment notifications (optional, outbound-only) | |
| SLACK_BOT_TOKEN=xoxb-... | |
| SLACK_DEPLOYMENT_CHANNEL_ID=C0123456789 | |
| ``` | |
| Slack notifications use the Slack Web API to post deployment status into one approved channel. This path is outbound-only: no Socket Mode, event subscriptions, slash commands, or public request URL. The Slack app needs only the `chat:write` bot scope and must be invited to the target channel. | |
| ## π― Usage | |
| The **App tab** is the primary interface β fill the form, press **GO**, and the pipeline runs end to end: | |
| 1. **Fill the form** β vertical / line of business / function (or a custom use case), the company URL, and the target **ThoughtSpot environment** | |
| 2. **Press GO** β research β blueprint β data generation β validation β Snowflake load β ThoughtSpot model + liveboard | |
| 3. **Review** β model and liveboard links, a Demo Pack, and a Spotter Viz story appear on completion | |
| ## π Project Structure | |
| ``` | |
| demoprep/ | |
| βββ app.py # Entry point β launches the Gradio app on :7860 | |
| βββ chat_interface.py # The full Gradio app (App/Chat/Admin/Settings/β¦) β historical name | |
| βββ thoughtspot_deployer.py # ThoughtSpot deploy: connection, tables, model, liveboard | |
| βββ liveboard_creator.py # MCP liveboard creation + TML post-processing (enhance_mcp_liveboard) | |
| βββ snowflake_auth.py # Snowflake keypair authentication | |
| βββ llm_config.py # LLM provider/model routing (single source of truth) | |
| βββ demo_personas.py # Vertical Γ Function use-case configs | |
| βββ demoprep_app/ # The demo-generation pipeline package | |
| β βββ pipeline/build_demo.py # the single build entry point | |
| β βββ scenario/ # blueprint contract + LLM authoring + directives | |
| β βββ dataset/ # deterministic engine + validator | |
| β βββ ddl/ # Snowflake DDL derived from the dataset | |
| β βββ integrations/snowflake/ # Snowflake row loader | |
| βββ requirements.txt # Python dependencies | |
| βββ docs/ # Documentation | |
| βββ tests/ # Unit tests + the e2e quality harness (e2e_quality.py) | |
| βββ results/ # Generated demo results | |
| ``` | |
| ## π§ͺ Testing | |
| ```bash | |
| # Unit tests (pytest collects test_*.py) | |
| python -m pytest tests/ | |
| # End-to-end quality harness β drives a running app via the browser and grades the output | |
| python tests/e2e_quality.py --env-name test | |
| ``` | |
| ## π€ Contributing | |
| 1. Fork the repository | |
| 2. Create a feature branch (`git checkout -b feature/amazing-feature`) | |
| 3. Commit your changes (`git commit -m 'Add amazing feature'`) | |
| 4. Push to the branch (`git push origin feature/amazing-feature`) | |
| 5. Open a Pull Request | |
| ## π License | |
| This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | |
| ## π Acknowledgments | |
| - ThoughtSpot for the analytics platform | |
| - Snowflake for the data warehouse | |
| - OpenAI and Anthropic for the AI capabilities | |
| - Gradio for the web interface | |
| ## π Development Notes | |
| Sprint planning and working notes live in `dev_notes/` (gitignored); architecture and handoff docs are in `docs/`. | |
| ## π Support | |
| For support, create an issue in this repository. | |
| --- | |
| **Built with β€οΈ for the ThoughtSpot community** | |