Skip to content

Commit aa92e9b

Browse files
add new class to other samples
1 parent c421bd1 commit aa92e9b

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44

55
import aiofiles
6-
from agent_framework import DataContent
6+
from agent_framework import DataContent, HostedImageGenerationTool
77
from agent_framework.azure import AzureAIClient
88
from azure.identity.aio import AzureCliCredential
99

@@ -29,12 +29,13 @@ async def main() -> None:
2929
name="ImageGenAgent",
3030
instructions="Generate images based on user requirements.",
3131
tools=[
32-
{
33-
"type": "image_generation",
34-
"model": "gpt-image-1-mini",
35-
"quality": "low",
36-
"size": "1024x1024",
37-
}
32+
HostedImageGenerationTool(
33+
options={
34+
"model": "gpt-image-1-mini",
35+
"quality": "low",
36+
"size": "1024x1024",
37+
}
38+
)
3839
],
3940
) as agent,
4041
):

python/samples/getting_started/agents/openai/openai_responses_client_streaming_image_generation.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import base64
55

66
import anyio
7-
from agent_framework import DataContent
7+
from agent_framework import DataContent, HostedImageGenerationTool
88
from agent_framework.openai import OpenAIResponsesClient
99

1010
"""OpenAI Responses Client Streaming Image Generation Example
@@ -45,12 +45,13 @@ async def main():
4545
agent = OpenAIResponsesClient().create_agent(
4646
instructions="You are a helpful agent that can generate images.",
4747
tools=[
48-
{
49-
"type": "image_generation",
50-
"size": "1024x1024",
51-
"quality": "high",
52-
"partial_images": 3,
53-
}
48+
HostedImageGenerationTool(
49+
options={
50+
"size": "1024x1024",
51+
"quality": "high",
52+
"partial_images": 3,
53+
}
54+
)
5455
],
5556
)
5657

0 commit comments

Comments
 (0)