Skip to content

feat(service-ai): steer the agent to visualize_data for chart requests#1821

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/ai-chart-tool-preference
Jun 13, 2026
Merged

feat(service-ai): steer the agent to visualize_data for chart requests#1821
xuyushun441-sys merged 1 commit into
mainfrom
feat/ai-chart-tool-preference

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Why

Follow-up to #1820. In live testing, a small model (claude-haiku) sometimes answered a "draw a bar chart" request with a markdown table — running query_data/aggregate_data and formatting the numbers — instead of calling visualize_data. The chart still worked when explicitly told "use visualize_data", so this is a tool-selection problem, not a capability gap: the chart preference was buried as guideline #7 and competed with guideline #4 ("format with markdown tables").

What

  • data-explorer-skill.ts — adds a prominent "Choosing the right tool" section above the guidelines: chart intent (incl. Chinese terms 图表/柱状图/折线图/饼图/画图/可视化) → MUST call visualize_data, never substitute a table, and render even if the numbers were already fetched. Reconciles the table-formatting guideline and fixes the duplicate guideline numbering.
  • visualize-data.tool.ts — strengthens the tool description to be imperative ("the ONLY tool that draws a chart… you MUST call this, not a table").

Prompt-only tuning — no behavior/contract change, no new deps. Raises the likelihood the model reaches for visualize_data on a plain chart request without an explicit nudge. Inherently probabilistic (LLM tool selection), so this improves reliability rather than guaranteeing it.

🤖 Generated with Claude Code

Small models (e.g. claude-haiku) sometimes answered a "draw a bar chart"
request with a markdown TABLE — running query_data/aggregate_data and
formatting the numbers — instead of calling visualize_data. This was a
tool-selection problem, not a capability gap: the chart preference was buried
as guideline #7 and competed with guideline #4 ("format with markdown
tables").

- data-explorer-skill.ts: add a prominent "Choosing the right tool" section
  ABOVE the guidelines — chart intent (incl. CN terms 图表/柱状图/折线图/饼图/画图)
  → MUST call visualize_data; never substitute a table; reconcile the
  table-formatting guideline; fix duplicate guideline numbering.
- visualize-data.tool.ts: strengthen the tool description to be imperative
  ("the ONLY tool that draws a chart… you MUST call this, not a table; if you
  already fetched the numbers, still call visualize_data to render them").

Prompt-only tuning — no behavior/contract change. Raises the likelihood the
model reaches for visualize_data on a plain chart request without an explicit
"use visualize_data" nudge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 13, 2026 9:17pm

Request Review

@xuyushun441-sys
xuyushun441-sys merged commit f62b4de into main Jun 13, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/ai-chart-tool-preference branch June 13, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants