This commit is contained in:
Lily Shen 2026-10-25 08:14:32 +00:00 • committed by GitHub
commit 9fcd3ead60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -77,9 +77,12 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig):
litellm_params: GenericLiteLLMParams,
headers: dict,
) -> dict:
normalized_input: Final[str | ResponseInputParam] = (
[{"role": "user", "content": input}] if isinstance(input, str) else input
)
request: Final = super().transform_responses_api_request(
model,
input,
normalized_input,
response_api_optional_request_params,
litellm_params,
headers,

View file

@ -31,6 +31,29 @@ def local_model_cost_map(monkeypatch: pytest.MonkeyPatch) -> Generator[None, Non
class TestChatGPTResponsesAPITransformation:
@pytest.mark.parametrize(
("input_value", "expected_input"),
[
("Reply with OK", [{"role": "user", "content": "Reply with OK"}]),
("", [{"role": "user", "content": ""}]),
(
[{"role": "user", "content": "Reply with OK"}],
[{"role": "user", "content": "Reply with OK"}],
),
],
)
def test_chatgpt_wraps_string_input_for_codex_responses(self, input_value, expected_input) -> None:
config = ChatGPTResponsesAPIConfig()
request = config.transform_responses_api_request(
model="chatgpt/gpt-5.3-codex",
input=input_value,
response_api_optional_request_params={},
litellm_params=GenericLiteLLMParams(),
headers={},
)
assert request["input"] == expected_input
@pytest.mark.parametrize(
("requested_tier", "expected_tier"),
[("default", "default"), ("priority", "priority"), ("fast", "priority")],