fix(c-generative-ui): three polish followups (flat args, loop cap, chip text)#440
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1. render_spec(elements, root) instead of render_spec(spec) — matches what
gpt-5 reasoning='minimal' naturally emits; eliminates the visible
Pydantic 'spec: Field required' retry artifact in the chat.
2. Tighten prompt: explicit 'if render_spec and the data tools have already
been called this turn, you are DONE' — stops the double-loop where
gpt-5 re-runs all tools on the second iteration.
3. Welcome chip text now matches the aviation backend ('Airline operations
dashboard' / 'Filter to cancelled flights' instead of the off-theme
'Q3 sales dashboard' / 'contact form').
Mirrors to umbrella graph + prompt per the full-copy policy.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6225e42 to
3f66724
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three small followups to PR #436 that polish the c-generative-ui demo.
1.
render_specflat argsgpt-5 reasoning='minimal' frequently emits
render_specargs as{"elements": ..., "root": ...}instead of the wrapped{"spec": {"elements": ..., "root": ...}}the tool signature required. Pydantic rejected the first call; the LLM retried successfully; but the user saw an uglyError invoking tool 'render_spec' with kwargs ... spec: Field requiredblock in the chat.Fix: flatten the tool signature to
render_spec(elements: dict, root: str). Matches the spec's actual schema and matches what the LLM naturally emits. Tool body just wraps them back into{"elements": elements, "root": root}before serializing. Zero retries observed in the smoke run.2. Loop-termination prompt tightening
The agent loop was running render_spec + the 4 data tools TWICE per first turn — wasted LLM calls. Existing prompt said "return without further tool calls" but gpt-5 ignored it.
Fix: add explicit "Critical: if render_spec and the data tools have already been called this turn, you are DONE. Return with no tool_calls. Do NOT call render_spec again. Do NOT re-call the data tools." Smoke now shows exactly 1 render_spec + 4 data tools per first turn.
3. Welcome chip text aligned with aviation theme
Chip said "Show me a Q3 sales dashboard with three metrics" but the backend is aviation-themed. When the user clicked the chip, the LLM saw "Q3 sales" + an aviation tool catalog, got confused, and wrote a fictional sales dashboard description in prose instead of calling tools.
Fix: chip values now match the backend — "Show me a dashboard of airline operations." and "Filter to only the cancelled flights." (Replaces the broken second chip "Create a contact form" which was never relevant to this demo.)
Files
cockpit/chat/generative-ui/python/src/graph.py— flatten render_spec signaturecockpit/langgraph/streaming/python/src/dashboard_graph.py— umbrella mirrorcockpit/chat/generative-ui/python/prompts/dashboard.md— tighten loop instructions + update tool signature referencecockpit/langgraph/streaming/python/prompts/dashboard.md— umbrella mirrorcockpit/chat/generative-ui/angular/src/app/generative-ui.component.ts— chip textTest plan
pnpm nx run cockpit-chat-generative-ui-python:build— greenpnpm nx run cockpit-langgraph-streaming-python:build— greenpnpm nx run cockpit-chat-generative-ui-angular:build— green🤖 Generated with Claude Code