mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-05 08:23:17 +00:00
test(chatgpt): restore gpt-5.2 codex transformation coverage
This commit is contained in:
@@ -84,10 +84,17 @@ class TestChatGPTResponsesAPITransformation:
|
||||
assert headers["accept"] == "text/event-stream"
|
||||
assert headers["session_id"] == "session-123"
|
||||
|
||||
def test_chatgpt_forces_streaming_and_reasoning_include(self):
|
||||
@pytest.mark.parametrize(
|
||||
"model_name",
|
||||
[
|
||||
"chatgpt/gpt-5.2-codex",
|
||||
"chatgpt/gpt-5.3-codex",
|
||||
],
|
||||
)
|
||||
def test_chatgpt_forces_streaming_and_reasoning_include(self, model_name):
|
||||
config = ChatGPTResponsesAPIConfig()
|
||||
request = config.transform_responses_api_request(
|
||||
model="chatgpt/gpt-5.3-codex",
|
||||
model=model_name,
|
||||
input="hi",
|
||||
response_api_optional_request_params={},
|
||||
litellm_params=GenericLiteLLMParams(),
|
||||
@@ -100,10 +107,17 @@ class TestChatGPTResponsesAPITransformation:
|
||||
"You are Codex, based on GPT-5."
|
||||
)
|
||||
|
||||
def test_chatgpt_drops_unsupported_responses_params(self):
|
||||
@pytest.mark.parametrize(
|
||||
"model_name",
|
||||
[
|
||||
"chatgpt/gpt-5.2-codex",
|
||||
"chatgpt/gpt-5.3-codex-spark",
|
||||
],
|
||||
)
|
||||
def test_chatgpt_drops_unsupported_responses_params(self, model_name):
|
||||
config = ChatGPTResponsesAPIConfig()
|
||||
request = config.transform_responses_api_request(
|
||||
model="chatgpt/gpt-5.3-codex-spark",
|
||||
model=model_name,
|
||||
input="hi",
|
||||
response_api_optional_request_params={
|
||||
# unsupported by ChatGPT Codex
|
||||
@@ -139,14 +153,23 @@ class TestChatGPTResponsesAPITransformation:
|
||||
assert request["tools"] == [{"type": "function", "function": {"name": "hello"}}]
|
||||
assert request["tool_choice"] == {"type": "function", "function": {"name": "hello"}}
|
||||
|
||||
def test_chatgpt_non_stream_sse_response_parsing(self):
|
||||
@pytest.mark.parametrize(
|
||||
("model_name", "response_model"),
|
||||
[
|
||||
("chatgpt/gpt-5.2-codex", "gpt-5.2-codex"),
|
||||
("chatgpt/gpt-5.3-codex", "gpt-5.3-codex"),
|
||||
],
|
||||
)
|
||||
def test_chatgpt_non_stream_sse_response_parsing(
|
||||
self, model_name: str, response_model: str
|
||||
):
|
||||
config = ChatGPTResponsesAPIConfig()
|
||||
response_payload = {
|
||||
"id": "resp_test",
|
||||
"object": "response",
|
||||
"created_at": 1700000000,
|
||||
"status": "completed",
|
||||
"model": "gpt-5.3-codex",
|
||||
"model": response_model,
|
||||
"output": [
|
||||
{
|
||||
"type": "message",
|
||||
@@ -168,7 +191,7 @@ class TestChatGPTResponsesAPITransformation:
|
||||
logging_obj = MagicMock()
|
||||
|
||||
parsed = config.transform_response_api_response(
|
||||
model="chatgpt/gpt-5.3-codex",
|
||||
model=model_name,
|
||||
raw_response=raw_response,
|
||||
logging_obj=logging_obj,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user