fix(chatgpt): omit unsupported previous response ids

This commit is contained in:
Alexandr A. Alexandrov 2026-09-17 21:39:12 +00:00
parent f2118fc767
commit f26a9fe4b6
2 changed files with 22 additions and 2 deletions

View file

@ -108,7 +108,6 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig):
"tools",
"tool_choice",
"reasoning",
"previous_response_id",
"truncation",
}

View file

@ -189,6 +189,27 @@ class TestChatGPTResponsesAPITransformation:
assert "reasoning.encrypted_content" in request["include"]
assert request["instructions"].startswith("You are Codex, based on GPT-5.")
def test_chatgpt_omits_foreign_previous_response_id(self):
config = ChatGPTResponsesAPIConfig()
input_items = [
{
"type": "message",
"role": "user",
"content": [{"type": "input_text", "text": "continue"}],
}
]
request = config.transform_responses_api_request(
model="chatgpt/gpt-5.6-sol",
input=input_items,
response_api_optional_request_params={"previous_response_id": "resp_foreign_fixture"},
litellm_params=GenericLiteLLMParams(),
headers={},
)
assert "previous_response_id" not in request
assert request["input"] == input_items
@pytest.mark.parametrize(
"model_name",
[
@ -230,7 +251,7 @@ class TestChatGPTResponsesAPITransformation:
assert "stream_options" not in request
assert request["truncation"] == "auto"
assert request["previous_response_id"] == "resp_123"
assert "previous_response_id" not in request
assert request["reasoning"] == {"effort": "medium"}
assert request["tools"] == [{"type": "function", "function": {"name": "hello"}}]
assert request["tool_choice"] == {