Skip to main content
Similar to providing multimodal inputs, you can also get multimodal outputs from an agent.

Image Generation using a tool

The following example demonstrates how to generate an image using an OpenAI tool with an agent.
image_agent.py
The output of the tool generating a media also goes to the model’s input as a message so it has access to the media (image, audio, video) and can use it in the response. For example, if you say “Generate an image of a dog and tell me its color.” the model will have access to the image and can use it to describe the dog’s color in the response in the same run.That also means you can ask follow-up questions about the image, since it would be available in the history of the agent.