Fix #4478: Detect Azure OpenAI models by endpoint, not just deployment name#4480
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
Fix #4478: Detect Azure OpenAI models by endpoint, not just deployment name#4480devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
Fixes #4478. The is_openai_model flag was only set based on model name prefixes (gpt-, o1-, text-), but Azure deployment names can be anything (e.g. gpt5nano). Now is_openai_model is also True when the endpoint is an Azure OpenAI endpoint (openai.azure.com/openai/deployments/), ensuring response_model, tool calling, and structured output work regardless of the deployment name. Co-Authored-By: João <joao@crewai.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix #4478: Detect Azure OpenAI models by endpoint, not just deployment name
Summary
AzureCompletion.is_openai_modelwas determined solely by checking model name prefixes (gpt-,o1-,text-). Since Azure deployment names can be arbitrary (e.g.gpt5nano), this causedis_openai_modelto beFalsefor custom-named deployments, which silently broke:response_model/ structured output (JSON schema not sent to API, validation skipped)supports_function_calling()returningFalseFix: Compute
is_azure_openai_endpointfirst, then use it as an additional signal — if the endpoint matchesopenai.azure.com+/openai/deployments/, it's an OpenAI model regardless of deployment name. Non-OpenAI models on Azure AI Inference endpoints (e.g.models.inference.ai.azure.com) are unaffected.The production code change is 6 lines in
AzureCompletion.__init__(). 7 new regression tests added covering detection, response_model parsing, params preparation, tool inclusion, streaming, and negative cases.Review & Testing Checklist for Human
openai.azure.com/openai/deployments/always implies an OpenAI model — could a non-OpenAI model ever be deployed at this endpoint pattern?gpt5nano) and aresponse_modelto confirm structured output workstest_azure_deepseek_model_supportandtest_azure_mistral_and_other_modelsstill correctly identify non-OpenAI models asis_openai_model=False(they pass in CI, but worth a glance)Notes