Add explicit validation for empty model_id in AzureOpenAIResponsesClient

Reject empty or whitespace-only model_id with ValueError instead of
silently passing an empty deployment name downstream. This ensures the
test_init_model_id_kwarg_empty_string test correctly validates behavior
defined in production code rather than relying on downstream validation.

Addresses PR review feedback for #4299.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Evan Mattson
2026-02-26 20:20:02 +09:00
co-authored by Copilot
parent 9c3d8c7958
commit c5dc3b98fd
@@ -181,6 +181,8 @@ class AzureOpenAIResponsesClient( # type: ignore[misc]
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:
deployment_name = str(model_id)