From d16f0ca2da41cb6da5f27b709a0ab3a9d08ac47a Mon Sep 17 00:00:00 2001 From: ahibrahim Date: Wed, 18 Feb 2026 14:57:38 +0200 Subject: [PATCH 1/3] updates --- .../agents/tools/sample_agent_image_generation.py | 14 +++++++------- .../tools/sample_agent_image_generation_async.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py index 3fd58f5aa926..1d0ed1eabe29 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py @@ -29,14 +29,14 @@ page of your Microsoft Foundry portal. 2) AZURE_AI_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model (e.g., gpt-4o, gpt-4o-mini, gpt-5o, gpt-5o-mini) used by the agent for understanding and responding to prompts. This is NOT the image generation model. - 3) IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME - The deployment name of the image generation model (e.g., gpt-image-1-mini) + 3) IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME - The deployment name of the image generation model (e.g., gpt-image-1) used by the ImageGenTool. NOTE: - - Image generation requires a separate "gpt-image-1-mini" deployment which is specified when constructing + - Image generation requires a separate "gpt-image-1" deployment which is specified when constructing the `ImageGenTool`, as well as providing it in the `x-ms-oai-image-generation-deployment` header when calling `.responses.create`. - - AZURE_AI_MODEL_DEPLOYMENT_NAME should be set to your chat model (e.g., gpt-4o), NOT "gpt-image-1-mini". + - AZURE_AI_MODEL_DEPLOYMENT_NAME should be set to your chat model (e.g., gpt-4o), NOT "gpt-image-1". - The generated image will be saved as "microsoft.png" in the OS temporary directory. """ @@ -62,14 +62,14 @@ # [START tool_declaration] tool = ImageGenTool( # type: ignore[call-overload] - model=image_generation_model, # Model such as "gpt-image-1-mini" # type: ignore + model=image_generation_model, # Model such as "gpt-image-1" # type: ignore quality="low", size="1024x1024", ) # [END tool_declaration] agent = project_client.agents.create_version( - agent_name="MyAgent", + agent_name="ahibrahim-image-gen", definition=PromptAgentDefinition( model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], instructions="Generate images based on user prompts", @@ -89,8 +89,8 @@ print(f"Response created: {response.id}") print("\nCleaning up...") - project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version) - print("Agent deleted") + # project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version) + # print("Agent deleted") # [START download_image] image_data = [output.result for output in response.output if output.type == "image_generation_call"] diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py index 0ad945453783..de7ec9707c95 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation_async.py @@ -29,14 +29,14 @@ page of your Microsoft Foundry portal. 2) AZURE_AI_MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project. - 3) IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME - The deployment name of the image generation model (e.g., gpt-image-1-mini) + 3) IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME - The deployment name of the image generation model (e.g., gpt-image-1) used by the ImageGenTool. NOTE: - - Image generation requires a separate "gpt-image-1-mini" deployment which is specified when constructing + - Image generation requires a separate "gpt-image-1" deployment which is specified when constructing the `ImageGenTool`, as well as providing it in the `x-ms-oai-image-generation-deployment` header when calling `.responses.create`. - - AZURE_AI_MODEL_DEPLOYMENT_NAME should be set to your chat model (e.g., gpt-4o), NOT "gpt-image-1-mini". + - AZURE_AI_MODEL_DEPLOYMENT_NAME should be set to your chat model (e.g., gpt-4o), NOT "gpt-image-1". - The generated image will be saved as "microsoft.png" in the OS temporary directory. """ From 93f8dd9130e8a7d96149ac8088e1e77dc2c74820 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim <109527914+ahibrahimm@users.noreply.github.com> Date: Wed, 18 Feb 2026 23:47:22 +0200 Subject: [PATCH 2/3] rename agent_name back to MyAgent Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../samples/agents/tools/sample_agent_image_generation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py index 1d0ed1eabe29..fbc5413ae1be 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py @@ -69,7 +69,7 @@ # [END tool_declaration] agent = project_client.agents.create_version( - agent_name="ahibrahim-image-gen", + agent_name="MyAgent", definition=PromptAgentDefinition( model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"], instructions="Generate images based on user prompts", From 596a14ddc54f3e0f3758413e4df960885ddcd8d3 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim <109527914+ahibrahimm@users.noreply.github.com> Date: Wed, 18 Feb 2026 23:47:47 +0200 Subject: [PATCH 3/3] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../samples/agents/tools/sample_agent_image_generation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py index fbc5413ae1be..7ee649c67fb2 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py @@ -89,8 +89,8 @@ print(f"Response created: {response.id}") print("\nCleaning up...") - # project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version) - # print("Agent deleted") + project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version) + print("Agent deleted") # [START download_image] image_data = [output.result for output in response.output if output.type == "image_generation_call"]