Model native image generation support
Old issue link: https://github.com/google/adk-python/issues/206#issuecomment-2817019103
It seems that there is a problem with generating image.
Agno do it like this:https://github.com/agno-agi/agno/blob/cc325f0cc81c9437c032bd43c570104cecd57884/cookbook/models/google/gemini/async_image_generation.py#L17
Were you using the gemini-2.0-flash-exp-image-generation model?
@boyangsvl Yes. both gemini-2.0-flash-exp-image-generation & gemini-2.0-flash-exp make same error.
This is adk web error:
My code
# my_agent/agent.py
from google.adk.agents import LlmAgent
root_agent = LlmAgent(
name="simple_assistant",
model="gemini-2.0-flash-exp-image-generation", # Or your preferred Gemini model
#instruction="You are a helpful assistant.",
description="A helpful assistant.",
generate_content_config={"response_modalities": ["TEXT", "IMAGE"]},
)
@inspire-boy I tested using "gemini-2.0-flash-preview-image-generation", the latest model that supports image generation. The generated image bytes is shown on my terminal output. However adk web doesn't render the output, which is something we could look to improve. Closing now
https://github.com/google/adk-python/blob/main/contributing/samples/generate_image/agent.py#L26-L44 here's an example of how you can use image generation as a tool.
I will add this to adk-web to support specifying response_modality and render image parts.
ok, will take a look
It’cool. let's look forward