Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions samples/agent/adk/restaurant_finder/a2ui_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,24 @@
}} }}
]
---END CONFIRMATION_EXAMPLE---
---BEGIN NO_RESULTS_EXAMPLE---
[
{{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }},
{{ "surfaceUpdate": {{
"surfaceId": "default",
"components": [
{{ "id": "root-column", "component": {{ "Column": {{ "children": {{ "explicitList": ["title-heading"] }} }} }} }},
{{ "id": "title-heading", "component": {{ "Text": {{ "usageHint": "h1", "text": {{ "path": "title" }} }} }} }}
]
}} }},
{{ "dataModelUpdate": {{
"surfaceId": "default",
"path": "/",
"contents": [
{{ "key": "title", "valueString": "Sorry, our current dataset only includes restaurants in New York City. No restaurants were found in the specified location." }}
]
}} }}
]
---END NO_RESULTS_EXAMPLE---
"""
1 change: 1 addition & 0 deletions samples/agent/adk/restaurant_finder/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
1. **For finding restaurants:**
a. You MUST call the `get_restaurants` tool. Extract the cuisine, location, and a specific number (`count`) of restaurants from the user's query (e.g., for "top 5 chinese places", count is 5).
b. After receiving the data, you MUST follow the instructions precisely to generate the final a2ui UI JSON, using the appropriate UI example from the `prompt_builder.py` based on the number of restaurants.
c. If the get_restaurants tool returns an empty list ([]), you MUST use the NO_RESULTS_EXAMPLE to inform the user that no restaurants were found.

2. **For booking a table (when you receive a query like 'USER_WANTS_TO_BOOK...'):**
a. You MUST use the appropriate UI example from `prompt_builder.py` to generate the UI, populating the `dataModelUpdate.contents` with the details from the user's query.
Expand Down
1 change: 1 addition & 0 deletions samples/agent/adk/restaurant_finder/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ def get_ui_prompt(base_url: str, examples: str) -> str:
- If the number of restaurants is more than 5, you MUST use the `TWO_COLUMN_LIST_EXAMPLE` template.
- If the query is to book a restaurant (e.g., "USER_WANTS_TO_BOOK..."), you MUST use the `BOOKING_FORM_EXAMPLE` template.
- If the query is a booking submission (e.g., "User submitted a booking..."), you MUST use the `CONFIRMATION_EXAMPLE` template.
- If the `get_restaurants` tool returns an empty list ([]), you MUST use the `NO_RESULTS_EXAMPLE` template.

{formatted_examples}

Expand Down