This commit is contained in:
Jesse van Dijk 2026-09-14 23:15:13 -07:00 committed by GitHub
commit 0a9e065d59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View file

@ -762,6 +762,8 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):
"""
Transform the delete response API response into a DeleteResponseResult
"""
if not raw_response.is_success:
raise OpenAIError(message=raw_response.text, status_code=raw_response.status_code)
try:
raw_response_json: Final = _delete_response_body(raw_response)
except Exception:

View file

@ -10,6 +10,7 @@ import pytest
import litellm
from litellm.llms.base_llm.responses.transformation import BaseResponsesAPIConfig
from litellm.llms.azure.responses.transformation import AzureOpenAIResponsesAPIConfig
from litellm.llms.openai.common_utils import OpenAIError
from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig
from litellm.types.llms.openai import (
ImageGenerationPartialImageEvent,
@ -43,6 +44,30 @@ class TestOpenAIResponsesAPIConfig:
# The function should return the params unchanged
assert result == test_params
@pytest.mark.parametrize(
"config",
[OpenAIResponsesAPIConfig(), AzureOpenAIResponsesAPIConfig()],
)
def test_delete_response_preserves_not_found_status(self, config):
response = httpx.Response(
status_code=404,
json={
"error": {
"message": "Response not found",
"type": "invalid_request_error",
}
},
request=httpx.Request("DELETE", "https://example.com/v1/responses/resp_missing"),
)
with pytest.raises(OpenAIError) as exc_info:
config.transform_delete_response_api_response(
raw_response=response,
logging_obj=self.logging_obj,
)
assert exc_info.value.status_code == 404
@pytest.mark.parametrize("max_output_tokens", [1, 15])
def test_map_openai_params_clamps_max_output_tokens_below_minimum(self, max_output_tokens):
"""OpenAI's Responses API rejects max_output_tokens < 16.