Spaces:
Running
Running
fix: spotter viz story — clean prompt-only format, include full model URL
Browse files- Remove ### Step N: headers and Expected result/What to look for lines
from both story prompts — Spotter Viz is an AI agent, it only needs
the raw prompts
- Pass full model URL (ts_url/#/data/tables/model_guid) so Spotter can
identify the data source without asking for confirmation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- chat_interface.py +17 -3
- prompts.py +31 -31
chat_interface.py
CHANGED
|
@@ -2271,7 +2271,8 @@ To change settings, use:
|
|
| 2271 |
- **End with action**: Show how insights lead to decisions""")
|
| 2272 |
|
| 2273 |
def _generate_ai_spotter_story(self, company_name: str, use_case: str,
|
| 2274 |
-
model_name: str = None,
|
|
|
|
| 2275 |
"""Pure AI-generated Spotter Viz story — no matrix reference.
|
| 2276 |
AI decides what a compelling liveboard story looks like for this company + use case.
|
| 2277 |
"""
|
|
@@ -2285,6 +2286,8 @@ To change settings, use:
|
|
| 2285 |
company_context = f"Company: {company_name}\nUse Case: {use_case}"
|
| 2286 |
if model_name:
|
| 2287 |
company_context += f"\nData Source/Model: {model_name}"
|
|
|
|
|
|
|
| 2288 |
if liveboard_name:
|
| 2289 |
company_context += f"\nLiveboard Name: {liveboard_name}"
|
| 2290 |
if hasattr(self, 'demo_builder') and self.demo_builder:
|
|
@@ -2313,7 +2316,8 @@ To change settings, use:
|
|
| 2313 |
return f"*(Generation failed: {e})*"
|
| 2314 |
|
| 2315 |
def _generate_matrix_spotter_story(self, company_name: str, use_case: str,
|
| 2316 |
-
model_name: str = None,
|
|
|
|
| 2317 |
"""Matrix/ThoughtSpot-recommended Spotter Viz story.
|
| 2318 |
Builds from the vertical×function matrix (KPIs, liveboard_questions, story controls, persona).
|
| 2319 |
AI writes it — adds narrative — but every step comes from the matrix.
|
|
@@ -2334,6 +2338,8 @@ To change settings, use:
|
|
| 2334 |
use_case_name = uc_cfg.get("use_case_name", use_case)
|
| 2335 |
|
| 2336 |
matrix_context = f"Company: {company_name}\nUse Case: {use_case_name}\nData Source/Model: {data_source}"
|
|
|
|
|
|
|
| 2337 |
if liveboard_name:
|
| 2338 |
matrix_context += f"\nLiveboard Name: {liveboard_name}"
|
| 2339 |
if persona:
|
|
@@ -3932,10 +3938,18 @@ Ask these questions to showcase ThoughtSpot's AI capabilities:
|
|
| 3932 |
|
| 3933 |
# Generate Spotter Viz Stories (both matrix and AI versions)
|
| 3934 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3935 |
_story_args = dict(
|
| 3936 |
company_name=company_name,
|
| 3937 |
use_case=use_case,
|
| 3938 |
-
model_name=
|
|
|
|
| 3939 |
liveboard_name=results.get('liveboard', None),
|
| 3940 |
)
|
| 3941 |
self.spotter_story_matrix = self._generate_matrix_spotter_story(**_story_args)
|
|
|
|
| 2271 |
- **End with action**: Show how insights lead to decisions""")
|
| 2272 |
|
| 2273 |
def _generate_ai_spotter_story(self, company_name: str, use_case: str,
|
| 2274 |
+
model_name: str = None, model_url: str = None,
|
| 2275 |
+
liveboard_name: str = None) -> str:
|
| 2276 |
"""Pure AI-generated Spotter Viz story — no matrix reference.
|
| 2277 |
AI decides what a compelling liveboard story looks like for this company + use case.
|
| 2278 |
"""
|
|
|
|
| 2286 |
company_context = f"Company: {company_name}\nUse Case: {use_case}"
|
| 2287 |
if model_name:
|
| 2288 |
company_context += f"\nData Source/Model: {model_name}"
|
| 2289 |
+
if model_url:
|
| 2290 |
+
company_context += f"\nModel URL: {model_url}"
|
| 2291 |
if liveboard_name:
|
| 2292 |
company_context += f"\nLiveboard Name: {liveboard_name}"
|
| 2293 |
if hasattr(self, 'demo_builder') and self.demo_builder:
|
|
|
|
| 2316 |
return f"*(Generation failed: {e})*"
|
| 2317 |
|
| 2318 |
def _generate_matrix_spotter_story(self, company_name: str, use_case: str,
|
| 2319 |
+
model_name: str = None, model_url: str = None,
|
| 2320 |
+
liveboard_name: str = None) -> str:
|
| 2321 |
"""Matrix/ThoughtSpot-recommended Spotter Viz story.
|
| 2322 |
Builds from the vertical×function matrix (KPIs, liveboard_questions, story controls, persona).
|
| 2323 |
AI writes it — adds narrative — but every step comes from the matrix.
|
|
|
|
| 2338 |
use_case_name = uc_cfg.get("use_case_name", use_case)
|
| 2339 |
|
| 2340 |
matrix_context = f"Company: {company_name}\nUse Case: {use_case_name}\nData Source/Model: {data_source}"
|
| 2341 |
+
if model_url:
|
| 2342 |
+
matrix_context += f"\nModel URL: {model_url}"
|
| 2343 |
if liveboard_name:
|
| 2344 |
matrix_context += f"\nLiveboard Name: {liveboard_name}"
|
| 2345 |
if persona:
|
|
|
|
| 3938 |
|
| 3939 |
# Generate Spotter Viz Stories (both matrix and AI versions)
|
| 3940 |
try:
|
| 3941 |
+
_model_name = results.get('model', None)
|
| 3942 |
+
_model_guid = results.get('model_guid', None)
|
| 3943 |
+
_ts_url = (self.settings.get('thoughtspot_url') or '').rstrip('/')
|
| 3944 |
+
if _model_guid and _ts_url:
|
| 3945 |
+
_model_url = f"{_ts_url}/#/data/tables/{_model_guid}"
|
| 3946 |
+
else:
|
| 3947 |
+
_model_url = None
|
| 3948 |
_story_args = dict(
|
| 3949 |
company_name=company_name,
|
| 3950 |
use_case=use_case,
|
| 3951 |
+
model_name=_model_name,
|
| 3952 |
+
model_url=_model_url,
|
| 3953 |
liveboard_name=results.get('liveboard', None),
|
| 3954 |
)
|
| 3955 |
self.spotter_story_matrix = self._generate_matrix_spotter_story(**_story_args)
|
prompts.py
CHANGED
|
@@ -571,58 +571,58 @@ Create a bullet outline demo script with:
|
|
| 571 |
- Spotter questions to ask live
|
| 572 |
- Closing value proposition""",
|
| 573 |
|
| 574 |
-
"spotter_viz_story_matrix": """You are
|
| 575 |
|
| 576 |
-
Spotter Viz is an AI agent
|
| 577 |
|
| 578 |
-
You have been given the ThoughtSpot-recommended KPIs, visualizations, and liveboard questions for this exact vertical and function.
|
| 579 |
|
| 580 |
{context}
|
| 581 |
|
| 582 |
---
|
| 583 |
|
| 584 |
-
|
| 585 |
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
|
| 591 |
Rules:
|
| 592 |
-
-
|
| 593 |
-
- KPI
|
| 594 |
-
- Chart
|
| 595 |
-
-
|
| 596 |
-
-
|
| 597 |
-
-
|
| 598 |
-
- Do not
|
| 599 |
|
| 600 |
-
"spotter_viz_story": """You are
|
| 601 |
|
| 602 |
-
Spotter Viz is an AI agent
|
| 603 |
|
| 604 |
-
Your job is to write
|
| 605 |
|
| 606 |
{context}
|
| 607 |
|
| 608 |
---
|
| 609 |
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
### Step N: [Brief label]
|
| 613 |
-
> "[The exact prompt to type into Spotter Viz]"
|
| 614 |
|
| 615 |
-
|
|
|
|
|
|
|
|
|
|
| 616 |
|
| 617 |
Rules:
|
| 618 |
-
-
|
| 619 |
-
-
|
| 620 |
-
-
|
| 621 |
-
-
|
| 622 |
-
- Final
|
| 623 |
-
- Use
|
| 624 |
-
- Keep prompts
|
| 625 |
-
-
|
| 626 |
}
|
| 627 |
|
| 628 |
DEFAULT_TEMPLATE = """You are helping create a {vertical} {function} demo.
|
|
|
|
| 571 |
- Spotter questions to ask live
|
| 572 |
- Closing value proposition""",
|
| 573 |
|
| 574 |
+
"spotter_viz_story_matrix": """You are writing a Spotter Viz story — a sequence of prompts a user pastes one at a time into Spotter Viz, ThoughtSpot's AI liveboard builder.
|
| 575 |
|
| 576 |
+
IMPORTANT: Spotter Viz is an AI agent. Output ONLY the prompts themselves — no step headers, no labels, no "what to look for" commentary. The prompts are the output.
|
| 577 |
|
| 578 |
+
You have been given the ThoughtSpot-recommended KPIs, visualizations, and liveboard questions for this exact vertical and function. Every KPI and visualization listed must appear as a prompt.
|
| 579 |
|
| 580 |
{context}
|
| 581 |
|
| 582 |
---
|
| 583 |
|
| 584 |
+
Output a numbered list of prompts. Each item is ONLY the prompt text — nothing else.
|
| 585 |
|
| 586 |
+
Example format:
|
| 587 |
+
1. "Create a new liveboard for [Company] using the data model [model name] at [model URL]. This is for [persona] to monitor [goal]."
|
| 588 |
+
2. "Add KPI tiles with monthly sparklines for [metric1], [metric2], and [metric3]. Show the latest value prominently with a 12-month trend."
|
| 589 |
+
3. "Add a bar chart showing [metric] by [dimension]."
|
| 590 |
|
| 591 |
Rules:
|
| 592 |
+
- Prompt 1: company name, full model URL, persona, and business goal
|
| 593 |
+
- KPI prompts: name every metric, specify monthly sparklines and 12-month trend
|
| 594 |
+
- Chart prompts: name the metric, chart type, and dimension to slice by
|
| 595 |
+
- Final prompt: the "aha moment" — highlight the key outlier or insight from the story controls
|
| 596 |
+
- Use real metric names from the matrix above
|
| 597 |
+
- Do not invent KPIs or visualizations that are not in the matrix
|
| 598 |
+
- Do not add any text outside the numbered prompts""",
|
| 599 |
|
| 600 |
+
"spotter_viz_story": """You are writing a Spotter Viz story — a sequence of prompts a user pastes one at a time into Spotter Viz, ThoughtSpot's AI liveboard builder.
|
| 601 |
|
| 602 |
+
IMPORTANT: Spotter Viz is an AI agent. Output ONLY the prompts themselves — no step headers, no labels, no "expected result" commentary. The prompts are the output.
|
| 603 |
|
| 604 |
+
Your job is to write 6-10 natural language prompts that build a compelling liveboard for this demo scenario, from scratch.
|
| 605 |
|
| 606 |
{context}
|
| 607 |
|
| 608 |
---
|
| 609 |
|
| 610 |
+
Output a numbered list of prompts. Each item is ONLY the prompt text — nothing else.
|
|
|
|
|
|
|
|
|
|
| 611 |
|
| 612 |
+
Example format:
|
| 613 |
+
1. "Create a new liveboard for [Company] using the data model [model name] at [model URL]. This is for [persona] to monitor [goal]."
|
| 614 |
+
2. "Add KPI tiles with monthly sparklines for [metric1], [metric2], and [metric3]. Show the latest value prominently with a 12-month trend."
|
| 615 |
+
3. "Add a bar chart showing [metric] by [dimension]."
|
| 616 |
|
| 617 |
Rules:
|
| 618 |
+
- Prompt 1: company name, full model URL, persona, and business goal
|
| 619 |
+
- Prompts 2-3: KPIs with monthly sparklines and 12-month trend
|
| 620 |
+
- Prompts 4-6: key charts — name the metric, chart type, and dimension
|
| 621 |
+
- Prompts 7-8: refinements — styling, liveboard name, organize into groups
|
| 622 |
+
- Final prompt: the "aha moment" — the key insight or outlier to highlight
|
| 623 |
+
- Use real column/metric names from the context above
|
| 624 |
+
- Keep prompts conversational — how a business user would actually talk
|
| 625 |
+
- Do not add any text outside the numbered prompts""",
|
| 626 |
}
|
| 627 |
|
| 628 |
DEFAULT_TEMPLATE = """You are helping create a {vertical} {function} demo.
|