Fix 404 in Azure OpenAI Graders by using Foundry client when azure_ai_project is provided #44763 #44768
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a 404 Not Found error in Azure OpenAI Graders by ensuring
evals.create()is called using the Azure AI Foundry project endpoint when
azure_ai_projectis provided.
Root Cause
The evaluation workflow always used the grader's Azure OpenAI client
(endpoint:
*.openai.azure.com). However, theevals.create()API is only availablevia Azure AI Foundry projects (endpoint:
*.services.ai.azure.com), causing 404 errorsin both the SDK and the Azure AI Foundry portal.
Fix
AIProjectClient.get_openai_client()whenazure_ai_projectis providedazure_ai_projectthrough the evaluation pipeline via kwargsazure_ai_projectis not providedFiles Changed
azure/ai/evaluation/_evaluate/_evaluate_aoai.py- Added Foundry client logic in_begin_single_aoai_evaluation()azure/ai/evaluation/_evaluate/_evaluate.py- Passazure_ai_projectin kwargs to AOAI evaluation functionsBackward Compatibility
No breaking changes. Existing workflows continue to use the grader client
when
azure_ai_projectis not specified.Checklist