Repository navigation
Replies: 1 comment
The output_type="image" decorator tells the Gradio UI how to render the output, but the tool itself still needs to return something the agent can use. Returning a PIL.Image object won't work because the agent (an LLM) can only read text. The correct approach is to: Save the image to a file from smolagents import tool @tool generate_plot.output_type = "image" Key points: The function returns a string (the file path), not a PIL.Image |
Uh oh!
There was an error while loading. Please reload this page.
I tried to have my tool return PIL.Image, and I tried setting output_type = 'image' and returning file name or PIL.Image. In all cases all the agent sees is a string that states "Stored image.png in memory". An example on the docs of how to make a tool with an image output would be appreciated
All reactions