mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-06 07:48:06 +00:00
Merge 95b22abd0f into 4ce724e3df
This commit is contained in:
commit
a96b7798ac
1 changed files with 26 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
from typing import cast
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from litellm.llms.base_llm.decisions.transformation import (
|
||||
BaseDecisionsConfig,
|
||||
DecisionsResponseValidationError,
|
||||
)
|
||||
from litellm.types.decisions import DecisionsIRRequest
|
||||
|
||||
|
||||
def test_transform_decisions_response_wraps_non_json_body():
|
||||
"""Regression for #48660: a non-JSON response body raised an unhandled
|
||||
pydantic ValidationError because `validate_json` ran outside the
|
||||
try/except. It must surface as DecisionsResponseValidationError instead."""
|
||||
config = BaseDecisionsConfig()
|
||||
raw_response = httpx.Response(status_code=502, content=b"<html>Bad Gateway</html>")
|
||||
|
||||
with pytest.raises(DecisionsResponseValidationError):
|
||||
config.transform_decisions_response(
|
||||
model="jev-latest",
|
||||
custom_llm_provider="systemone",
|
||||
raw_response=raw_response,
|
||||
request=cast(DecisionsIRRequest, None),
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue