Bug in ADK web when load artifact to display images. #3092
Replies: 1 comment 1 reply
-
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: Starting with Hello @NBestsuNgan, Thank you for reaching out. You've encountered an issue that is likely due to a change introduced in version 1.2.0 of the Previously, the ADK web interface might have used different heuristics to identify and render images. However, to make rendering more robust and standardized, this was changed. As noted in the changelog for version 1.2.0, the web UI now uses the The issue you're seeing is the typical browser behavior for a broken image link, which happens when the UI doesn't recognize the artifact as an image because the To fix this, you need to make sure you are setting the appropriate import google.genai.types as types
from google.adk.agents.callback_context import CallbackContext
# Assume 'image_bytes' contains your image data in bytes
# and 'context' is your available CallbackContext or ToolContext.
# Create a Part object with the image data and the correct mime_type.
# For example, 'image/png' or 'image/jpeg'.
image_part = types.Part.from_data(
data=image_bytes,
mime_type="image/png" # Or "image/jpeg", etc.
)
# Save the artifact
try:
version = await context.save_artifact(
filename="my_image.png",
artifact=image_part
)
print(f"Successfully saved image artifact, version: {version}")
except ValueError as e:
print(f"Error saving artifact: {e}") You can find more details on working with artifacts in the official documentation. [2] Please check your code where the artifact is being saved and ensure the Let us know if you have any other questions. [1] https://github.com/google/adk-python/blob/main/CHANGELOG.md |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
my config
"google-adk==1.14.0",
"google-genai==1.37.0",
"google-cloud-aiplatform[evaluation,agent-engines]~=1.119.0",
it have worked before but now it can't display artifact correctly in adk web, but it send artifact name with artifact_delta in a invocation payload correctly and front end can catch those link to display image. just, wonder why not it can not display in adk web.
Beta Was this translation helpful? Give feedback.
All reactions