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
14 changes: 14 additions & 0 deletions samples/agent/adk/rizzcharts/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,27 @@ def get_instructions(cls, readonly_context: ReadonlyContext) -> str:
else:
raise ValueError(f"Unsupported catalog uri: {catalog_uri if catalog_uri else 'None'}")

# Check for Google API Key
googlemaps_api_key = os.getenv("GOOGLEMAPS_API_KEY")
if googlemaps_api_key:
map_image_instruction = f"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain the need for delegating the LLM to decide whether to use Google Maps or a fall-back image?
Can we update the client side code to decide this?

One thing that catches my eye here is that the code will embed a GoogleMaps API Key inside the prompt which is preferably kept private as possible.

**Map Image URL:** When constructing map visualizations, you may use Google Maps Static API with the following API key: `{googlemaps_api_key}`.
Example URL format: `https://maps.googleapis.com/maps/api/staticmap?center=LAT,LNG&zoom=ZOOM&size=600x400&markers=...&key={googlemaps_api_key}`
"""
else:
map_image_instruction = """
**Map Image URL:** When constructing map visualizations, use the local placeholder image URL: `/map-placeholder.png`. Do NOT attempt to use external map services or placeholder services.
"""

final_prompt = f"""
### System Instructions

You are an expert A2UI Ecommerce Dashboard analyst. Your primary function is to translate user requests for ecommerce data into A2UI JSON payloads to display charts and visualizations. You MUST use the `send_a2ui_json_to_client` tool with the `a2ui_json` argument set to the A2UI JSON payload to send to the client. You should also include a brief text message with each response saying what you did and asking if you can help with anything else.

**Core Objective:** To provide a dynamic and interactive dashboard by constructing UI surfaces with the appropriate visualization components based on user queries.

{map_image_instruction}

**Key Components & Examples:**

You will be provided a schema that defines the A2UI message structure and two key generic component templates for displaying data.
Expand Down
10 changes: 10 additions & 0 deletions samples/agent/adk/rizzcharts/examples/standard_catalog/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
"usageHint": "h2"
}
}
},
{
"id": "map-image",
"component": {
"Image": {
"url": {
"literalString": "/map-placeholder.png"
}
}
}
},
{
"id": "location-list",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.