From b4df562094a2ffd5bc01b1b6e6db54cffb8dc05c Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Thu, 18 Dec 2025 00:09:21 +0800 Subject: [PATCH] fix: correct model name gpt-5.1-mini to gpt-5.1-codex-mini Fixes #2785 The model string `gpt-5.1-mini` was incorrectly listed in the ChatModel type. It should be `gpt-5.1-codex-mini` to match the actual model naming. Changes: - Updated gpt-5.1-mini to gpt-5.1-codex-mini in: - src/openai/types/shared/chat_model.py - src/openai/types/shared_params/chat_model.py - src/openai/resources/responses/responses.py - src/openai/types/responses/response_compact_params.py - Added test to verify the correct model name --- src/openai/resources/responses/responses.py | 4 +- .../responses/response_compact_params.py | 2 +- src/openai/types/shared/chat_model.py | 2 +- src/openai/types/shared_params/chat_model.py | 2 +- tests/test_chat_model_types.py | 55 +++++++++++++++++++ 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 tests/test_chat_model_types.py diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index 8e80f6793b..c6da518694 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -1536,7 +1536,7 @@ def compact( "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", - "gpt-5.1-mini", + "gpt-5.1-codex-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", @@ -3154,7 +3154,7 @@ async def compact( "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", - "gpt-5.1-mini", + "gpt-5.1-codex-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", diff --git a/src/openai/types/responses/response_compact_params.py b/src/openai/types/responses/response_compact_params.py index 657c6a0764..c02f79a7be 100644 --- a/src/openai/types/responses/response_compact_params.py +++ b/src/openai/types/responses/response_compact_params.py @@ -22,7 +22,7 @@ class ResponseCompactParams(TypedDict, total=False): "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", - "gpt-5.1-mini", + "gpt-5.1-codex-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", diff --git a/src/openai/types/shared/chat_model.py b/src/openai/types/shared/chat_model.py index 8223b81bef..d90c5ea395 100644 --- a/src/openai/types/shared/chat_model.py +++ b/src/openai/types/shared/chat_model.py @@ -13,7 +13,7 @@ "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", - "gpt-5.1-mini", + "gpt-5.1-codex-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", diff --git a/src/openai/types/shared_params/chat_model.py b/src/openai/types/shared_params/chat_model.py index c1937a8312..b0edee18d4 100644 --- a/src/openai/types/shared_params/chat_model.py +++ b/src/openai/types/shared_params/chat_model.py @@ -15,7 +15,7 @@ "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", - "gpt-5.1-mini", + "gpt-5.1-codex-mini", "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", diff --git a/tests/test_chat_model_types.py b/tests/test_chat_model_types.py new file mode 100644 index 0000000000..f8d0d2e459 --- /dev/null +++ b/tests/test_chat_model_types.py @@ -0,0 +1,55 @@ +"""Tests for ChatModel type definitions. + +Verifies that the ChatModel type includes correct model names. +Relates to issue #2785: GPT 5.1 Mini wrongly listed in model list +""" + +import pytest +from typing import get_args + +from openai.types.shared import ChatModel + + +class TestChatModelTypes: + """Test ChatModel type definitions.""" + + def test_gpt_5_1_codex_mini_exists(self) -> None: + """Verify gpt-5.1-codex-mini is in ChatModel (fixes #2785).""" + # Get all valid ChatModel values + valid_models = get_args(ChatModel) + + # gpt-5.1-codex-mini should exist (not gpt-5.1-mini) + assert "gpt-5.1-codex-mini" in valid_models, ( + "gpt-5.1-codex-mini should be in ChatModel" + ) + + def test_gpt_5_1_mini_not_exists(self) -> None: + """Verify gpt-5.1-mini is NOT in ChatModel (was incorrect).""" + valid_models = get_args(ChatModel) + + # gpt-5.1-mini should NOT exist (it was wrongly listed) + assert "gpt-5.1-mini" not in valid_models, ( + "gpt-5.1-mini should NOT be in ChatModel (issue #2785)" + ) + + def test_gpt_5_1_codex_exists(self) -> None: + """Verify gpt-5.1-codex is in ChatModel.""" + valid_models = get_args(ChatModel) + assert "gpt-5.1-codex" in valid_models + + def test_gpt_5_family_models_exist(self) -> None: + """Verify GPT-5 family models are present.""" + valid_models = get_args(ChatModel) + + expected_gpt5_models = [ + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "gpt-5.1", + "gpt-5.1-codex", + "gpt-5.1-codex-mini", + "gpt-5.2", + ] + + for model in expected_gpt5_models: + assert model in valid_models, f"{model} should be in ChatModel"