diff --git a/samples/agent/adk/rizzcharts/agent.py b/samples/agent/adk/rizzcharts/agent.py index 137c1773..5f71ee4e 100644 --- a/samples/agent/adk/rizzcharts/agent.py +++ b/samples/agent/adk/rizzcharts/agent.py @@ -72,6 +72,18 @@ 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""" +**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 @@ -79,6 +91,8 @@ def get_instructions(cls, readonly_context: ReadonlyContext) -> str: **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. diff --git a/samples/agent/adk/rizzcharts/examples/standard_catalog/map.json b/samples/agent/adk/rizzcharts/examples/standard_catalog/map.json index f6061c5a..d89dc3c7 100644 --- a/samples/agent/adk/rizzcharts/examples/standard_catalog/map.json +++ b/samples/agent/adk/rizzcharts/examples/standard_catalog/map.json @@ -38,6 +38,16 @@ "usageHint": "h2" } } + }, + { + "id": "map-image", + "component": { + "Image": { + "url": { + "literalString": "/map-placeholder.png" + } + } + } }, { "id": "location-list", diff --git a/samples/client/lit/shell/public/map-placeholder.png b/samples/client/lit/shell/public/map-placeholder.png new file mode 100644 index 00000000..43970148 Binary files /dev/null and b/samples/client/lit/shell/public/map-placeholder.png differ