Skip to content

Conversation

@dargilco
Copy link
Member

@dargilco dargilco commented Dec 4, 2025

  • Add async test
  • Add test recordings of both OpenAI and AIProject client network calls in these tests. Remove the "skip test" decorators.
  • Per Paul, if you are using an image generation AI model that is not the default one (gpt-image-1), you need to mention the image generation AI model in two places: while defining ImageGenTool (when creating the Agent) and when doing the Responses call, in a x-ms-oai-image-generation-deployment HTTP request header. Need to fix this public doc to do the same. I updated sample code to do this as well as test code. And changes sample code to use gpt-image-1-mini instead of gpt-image-1 to show an example of a non-default model.
  • Read image generation model deployment name from test base, similar to what we do for other classes
  • Fail test if the model is not deployed to the Foundry Project (instead of skipping it).
  • Save resulting image on .asserts folder (which is listed in .gitignore)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the agent image generation tool tests to enable recording and adds an async version of the test. The changes refactor configuration management by moving the image model deployment name from environment variables to a test parameter dictionary, aligning with the pattern used for other test configurations.

Key Changes:

  • Created new async test for image generation (test_agent_image_generation_async.py)
  • Updated sync test to use recorded_by_proxy decorator instead of skipping during recording
  • Refactored configuration to use test_agents_tools_params dictionary instead of environment variable
  • Added test recordings (assets.json tag update)
  • Both tests now save generated images to .assets directory (which is properly gitignored)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/ai/azure-ai-projects/tests/test_base.py Moved image model deployment configuration from servicePreparer to new test_agents_tools_params dictionary for better organization
sdk/ai/azure-ai-projects/tests/agents/tools/test_agent_image_generation_async.py New async version of image generation test using recorded_by_proxy_async decorator with proper async context managers
sdk/ai/azure-ai-projects/tests/agents/tools/test_agent_image_generation.py Updated to use recorded_by_proxy decorator, changed pytest.skip to pytest.fail for missing deployments, added image saving functionality, and refactored to use new config structure
sdk/ai/azure-ai-projects/.env.template Removed obsolete AZURE_AI_PROJECTS_TESTS_IMAGE_MODEL_DEPLOYMENT_NAME environment variable entry
sdk/ai/azure-ai-projects/assets.json Updated test recording tag to reflect new test recordings

@dargilco dargilco enabled auto-merge (squash) December 5, 2025 06:56
@dargilco dargilco merged commit e549ce0 into main Dec 5, 2025
20 checks passed
@dargilco dargilco deleted the dargilco/add-recordings-to-agent-tool-tests branch December 5, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants