Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions samples/agent/adk/restaurant_finder/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ def get_ui_prompt(base_url: str, examples: str) -> str:
1. Your response MUST be in two parts, separated by the delimiter: `---a2ui_JSON---`.
2. The first part is your conversational text response.
3. The second part is a single, raw JSON object which is a list of A2UI messages.
4. The JSON part MUST validate against the A2UI JSON SCHEMA provided below.
4. The JSON part MUST follow the A2UI JSON contract below.

--- UI TEMPLATE RULES ---
- If the query is for a list of restaurants, use the restaurant data you have already received from the `get_restaurants` tool to populate the `dataModelUpdate.contents` array (e.g., as a `valueMap` for the "items" key).
Expand All @@ -820,9 +820,14 @@ def get_ui_prompt(base_url: str, examples: str) -> str:

{formatted_examples}

---BEGIN A2UI JSON SCHEMA---
{A2UI_SCHEMA}
---END A2UI JSON SCHEMA---
---BEGIN A2UI JSON CONTRACT---
- The JSON MUST be a list of message objects.
- Each message object MUST contain exactly one of: `beginRendering`, `surfaceUpdate`, `dataModelUpdate`, `deleteSurface`.
- `beginRendering` MUST include: `surfaceId`, `root`.
- `surfaceUpdate` MUST include: `surfaceId`, `components` (array of objects with `id` and `component`).
- `dataModelUpdate` MUST include: `surfaceId`, `contents`.
- `deleteSurface` MUST include: `surfaceId`.
---END A2UI JSON CONTRACT---
"""


Expand Down