adk-web icon indicating copy to clipboard operation
adk-web copied to clipboard

Model native image generation support

Open inspire-boy opened this issue 8 months ago • 7 comments

Old issue link: https://github.com/google/adk-python/issues/206#issuecomment-2817019103

It seems that there is a problem with generating image.

Image

Agno do it like this:https://github.com/agno-agi/agno/blob/cc325f0cc81c9437c032bd43c570104cecd57884/cookbook/models/google/gemini/async_image_generation.py#L17

inspire-boy avatar Apr 21 '25 14:04 inspire-boy

Were you using the gemini-2.0-flash-exp-image-generation model?

boyangsvl avatar Apr 21 '25 15:04 boyangsvl

@boyangsvl Yes. both gemini-2.0-flash-exp-image-generation & gemini-2.0-flash-exp make same error. This is adk web error: Image

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 avatar Apr 21 '25 16:04 inspire-boy

@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

wuliang229 avatar May 27 '25 23:05 wuliang229

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.

wuliang229 avatar May 27 '25 23:05 wuliang229

I will add this to adk-web to support specifying response_modality and render image parts.

boyangsvl avatar May 28 '25 17:05 boyangsvl

ok, will take a look

wyf7107 avatar Jun 04 '25 04:06 wyf7107

It’cool. let's look forward

inspire-boy avatar Jun 06 '25 14:06 inspire-boy