fix(openai): default Azure LLM model to deployment#6266
Conversation
|
nightcityblade seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
| @@ -238,8 +238,10 @@ def with_azure( | |||
| else httpx.Timeout(connect=15.0, read=5.0, write=5.0, pool=5.0), | |||
| ) # type: ignore | |||
|
|
|||
| resolved_model = model if model is not None else azure_deployment or "gpt-4o" | |||
There was a problem hiding this comment.
We can simply use unknown as the last resort, as the model parameter is only used for metric/label.
|
Addressed the review note in 4c0ede6. Validation:
|
|
I pushed a follow-up commit to align with the review suggestion: Azure now keeps as the fallback model label unless the caller explicitly provides , and I updated the config expectation to match.\n\nI also rechecked the simple constructor path locally against the new behavior. |
|
I pushed a follow-up commit to align with the review suggestion: Azure now keeps "unknown" as the fallback model label unless the caller explicitly provides I also rechecked the simple |
|
Followed up in 274decd to narrow the fallback exactly the way suggested. Behavior now:
Validation rerun:
|
| resolved_model = ( | ||
| model | ||
| if model is not None | ||
| else "unknown" | ||
| if azure_deployment is not None | ||
| else "gpt-4o" | ||
| ) |
There was a problem hiding this comment.
🚩 Behavioral change for existing Azure users who relied on model='gpt-4o' with deployments
Previously, all LLM.with_azure() callers got model='gpt-4o' regardless of whether they specified azure_deployment. Now, callers who pass azure_deployment without an explicit model will see llm.model return "unknown" instead of "gpt-4o". This affects any downstream code that reads llm.model for metrics labels, logging, or conditional logic. The code comment at livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py:241-250 states this is intentional ("Keep Azure metric labels neutral"), but it is a silent semantic change for existing integrations that may have dashboards or alerts keyed on model name.
Was this helpful? React with 👍 or 👎 to provide feedback.
Fixes #6209
Summary
LLM.with_azure()from exposing the unrelatedgpt-4odefault when Azure callers only setazure_deploymentllm.modelreflect the configured deploymentTesting