Skip to content

Commit b55095f

Browse files
authored
azureai image gen sample update (microsoft#2709)
1 parent 69225b4 commit b55095f

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

python/samples/getting_started/agents/azure_ai/azure_ai_with_image_generation.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# Copyright (c) Microsoft. All rights reserved.
2-
32
import asyncio
43
from pathlib import Path
54

65
import aiofiles
76
from agent_framework import DataContent
87
from agent_framework.azure import AzureAIClient
9-
from azure.ai.projects.models import ImageGenTool
108
from azure.identity.aio import AzureCliCredential
119

1210
"""
13-
Azure AI Agent With Image Generation
11+
Azure AI Agent with Image Generation Example
1412
1513
This sample demonstrates basic usage of AzureAIClient to create an agent
1614
that 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

Comments
 (0)