11# Copyright (c) Microsoft. All rights reserved.
2-
32import asyncio
43from pathlib import Path
54
65import aiofiles
76from agent_framework import DataContent
87from agent_framework .azure import AzureAIClient
9- from azure .ai .projects .models import ImageGenTool
108from azure .identity .aio import AzureCliCredential
119
1210"""
13- Azure AI Agent With Image Generation
11+ Azure AI Agent with Image Generation Example
1412
1513This sample demonstrates basic usage of AzureAIClient to create an agent
1614that can generate images based on user requirements.
@@ -30,7 +28,14 @@ async def main() -> None:
3028 AzureAIClient (credential = credential ).create_agent (
3129 name = "ImageGenAgent" ,
3230 instructions = "Generate images based on user requirements." ,
33- tools = [ImageGenTool (quality = "low" , size = "1024x1024" )],
31+ tools = [
32+ {
33+ "type" : "image_generation" ,
34+ "model" : "gpt-image-1-mini" ,
35+ "quality" : "low" ,
36+ "size" : "1024x1024" ,
37+ }
38+ ],
3439 ) as agent ,
3540 ):
3641 query = "Generate an image of Microsoft logo."
@@ -39,7 +44,7 @@ async def main() -> None:
3944 query ,
4045 # These additional options are required for image generation
4146 additional_chat_options = {
42- "extra_headers" : {"x-ms-oai-image-generation-deployment" : "gpt-image-1" },
47+ "extra_headers" : {"x-ms-oai-image-generation-deployment" : "gpt-image-1-mini " },
4348 },
4449 )
4550 print (f"Agent: { result } \n " )
0 commit comments