diff --git a/samples/agent/adk/restaurant_finder/a2ui_examples.py b/samples/agent/adk/restaurant_finder/a2ui_examples.py index b77a685e..a3044780 100644 --- a/samples/agent/adk/restaurant_finder/a2ui_examples.py +++ b/samples/agent/adk/restaurant_finder/a2ui_examples.py @@ -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--- """ diff --git a/samples/agent/adk/restaurant_finder/agent.py b/samples/agent/adk/restaurant_finder/agent.py index 5283cd88..a0485311 100644 --- a/samples/agent/adk/restaurant_finder/agent.py +++ b/samples/agent/adk/restaurant_finder/agent.py @@ -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. diff --git a/samples/agent/adk/restaurant_finder/prompt_builder.py b/samples/agent/adk/restaurant_finder/prompt_builder.py index 1cc8445e..14de3809 100644 --- a/samples/agent/adk/restaurant_finder/prompt_builder.py +++ b/samples/agent/adk/restaurant_finder/prompt_builder.py @@ -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}