Simplify model_id handling using walrus operator

Addresses review comment on PR #4310.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Evan Mattson
2026-02-27 08:29:01 +09:00
co-authored by Copilot
parent c5dc3b98fd
commit 5bed03ee4b
@@ -180,10 +180,7 @@ class AzureOpenAIResponsesClient( # type: ignore[misc]
client: AzureOpenAIResponsesClient[MyOptions] = AzureOpenAIResponsesClient()
response = await client.get_response("Hello", options={"my_custom_option": "value"})
"""
model_id = kwargs.pop("model_id", None)
if model_id is not None and not str(model_id).strip():
raise ValueError("model_id must not be empty")
if model_id is not None and deployment_name is None:
if (model_id := kwargs.pop("model_id", None)) and not deployment_name:
deployment_name = str(model_id)
# Project client path: create OpenAI client from an Azure AI Foundry project