Skip to content

Commit a1839f2

Browse files
committed
feat: add map image support to Rizzcharts with local placeholder
- Add local map-placeholder.png to shell public directory - Update standard_catalog/map.json with map-image component using local image - Update agent.py to instruct LLM to use local placeholder (or Google Maps API if key available) - Avoids dependency on external placehold.co service
1 parent b61bfb3 commit a1839f2

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

samples/agent/adk/rizzcharts/agent.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,27 @@ def get_instructions(cls, readonly_context: ReadonlyContext) -> str:
7272
else:
7373
raise ValueError(f"Unsupported catalog uri: {catalog_uri if catalog_uri else 'None'}")
7474

75+
# Check for Google API Key
76+
googlemaps_api_key = os.getenv("GOOGLEMAPS_API_KEY")
77+
if googlemaps_api_key:
78+
map_image_instruction = f"""
79+
**Map Image URL:** When constructing map visualizations, you may use Google Maps Static API with the following API key: `{googlemaps_api_key}`.
80+
Example URL format: `https://maps.googleapis.com/maps/api/staticmap?center=LAT,LNG&zoom=ZOOM&size=600x400&markers=...&key={googlemaps_api_key}`
81+
"""
82+
else:
83+
map_image_instruction = """
84+
**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.
85+
"""
86+
7587
final_prompt = f"""
7688
### System Instructions
7789
7890
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.
7991
8092
**Core Objective:** To provide a dynamic and interactive dashboard by constructing UI surfaces with the appropriate visualization components based on user queries.
8193
94+
{map_image_instruction}
95+
8296
**Key Components & Examples:**
8397
8498
You will be provided a schema that defines the A2UI message structure and two key generic component templates for displaying data.

samples/agent/adk/rizzcharts/examples/standard_catalog/map.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838
"usageHint": "h2"
3939
}
4040
}
41+
},
42+
{
43+
"id": "map-image",
44+
"component": {
45+
"Image": {
46+
"url": {
47+
"literalString": "/map-placeholder.png"
48+
}
49+
}
50+
}
4151
},
4252
{
4353
"id": "location-list",
82.8 KB
Loading

0 commit comments

Comments
 (0)