Skip to content

Commit c7cca5c

Browse files
bloveclaude
andcommitted
fix(c-generative-ui): use gpt-5 + minimal reasoning for planner LLM
gpt-5-mini ignored the "EXACTLY ONE tool" directive added in PR #363 and kept calling all four data tools on every filter follow-up. Verified live: my prompt rewrite was strict and explicit ("call EXACTLY ONE tool", "Do NOT call the other tools") but gpt-5-mini still fanned out — the model's default reasoning prefers thoroughness over literal directive-following. Split the LLMs: - `_llm` (gpt-5-mini) — unchanged for shell-gen + respond. Cheap and good enough for prose + JSON-spec emission. - `_planner_llm` (gpt-5, reasoning_effort='minimal') — bound to tools, used in plan_tools. gpt-5 follows directives more precisely; reasoning_effort='minimal' suppresses the "let me be thorough" deliberation that drives the fan-out. Standalone smoke (separate from chrome): prompt: "Filter to cancelled flights only" result: ['query_recent_disruptions'] ← exactly one Chrome MCP end-to-end: backend log confirms AI tool_calls: ['query_recent_disruptions'], data grid updates to 3 cancelled rows. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 10acc90 commit c7cca5c

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

cockpit/chat/generative-ui/python/src/graph.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,21 @@
2020
_PROMPT = (Path(__file__).parent.parent / "prompts" / "dashboard.md").read_text()
2121

2222
_llm = ChatOpenAI(model="gpt-5-mini", temperature=0, streaming=True)
23-
_llm_with_tools = _llm.bind_tools(ALL_TOOLS)
23+
24+
# Dedicated planner: full gpt-5 with minimal reasoning effort.
25+
# gpt-5-mini at default reasoning ignores the "EXACTLY ONE tool" directive
26+
# in plan_tools and reflexively calls all four data tools on every
27+
# follow-up — verified in chrome MCP after PR #363 tightened the prompt
28+
# but the model still over-called. Bumping the planner to gpt-5 sharpens
29+
# instruction-following, and reasoning_effort='minimal' suppresses the
30+
# "let me be thorough" deliberation that drives the fan-out.
31+
_planner_llm = ChatOpenAI(
32+
model="gpt-5",
33+
temperature=0,
34+
streaming=True,
35+
reasoning_effort="minimal",
36+
)
37+
_llm_with_tools = _planner_llm.bind_tools(ALL_TOOLS)
2438

2539

2640
class DashboardState(MessagesState):

cockpit/langgraph/streaming/python/src/dashboard_graph.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,21 @@
2020
_PROMPT = (Path(__file__).parent.parent / "prompts" / "dashboard.md").read_text()
2121

2222
_llm = ChatOpenAI(model="gpt-5-mini", temperature=0, streaming=True)
23-
_llm_with_tools = _llm.bind_tools(ALL_TOOLS)
23+
24+
# Dedicated planner: full gpt-5 with minimal reasoning effort.
25+
# gpt-5-mini at default reasoning ignores the "EXACTLY ONE tool" directive
26+
# in plan_tools and reflexively calls all four data tools on every
27+
# follow-up — verified in chrome MCP after PR #363 tightened the prompt
28+
# but the model still over-called. Bumping the planner to gpt-5 sharpens
29+
# instruction-following, and reasoning_effort='minimal' suppresses the
30+
# "let me be thorough" deliberation that drives the fan-out.
31+
_planner_llm = ChatOpenAI(
32+
model="gpt-5",
33+
temperature=0,
34+
streaming=True,
35+
reasoning_effort="minimal",
36+
)
37+
_llm_with_tools = _planner_llm.bind_tools(ALL_TOOLS)
2438

2539

2640
class DashboardState(MessagesState):

0 commit comments

Comments
 (0)