mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
Merge f4b9357d53 into af6dc1db08
This commit is contained in:
commit
0a9e065d59
2 changed files with 27 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue