diff --git a/litellm/types/decisions.py b/litellm/types/decisions.py index 9651dac950a..b24690dbd9d 100644 --- a/litellm/types/decisions.py +++ b/litellm/types/decisions.py @@ -320,7 +320,7 @@ class OpenAIDecisionResponse(_HiddenParamsResponse): answers: tuple[OpenAIDecisionAnswer, ...] usage: OpenAIDecisionUsage - model_config = ConfigDict(frozen=True) + model_config = ConfigDict(extra="allow", frozen=True) _NO_EXTRA: Final[Mapping[str, object]] = MappingProxyType({}) diff --git a/tests/unit/proxy/decisions_endpoints/test_endpoints.py b/tests/unit/proxy/decisions_endpoints/test_endpoints.py index 8fef59e3b6c..ccfa12e10d6 100644 --- a/tests/unit/proxy/decisions_endpoints/test_endpoints.py +++ b/tests/unit/proxy/decisions_endpoints/test_endpoints.py @@ -387,6 +387,29 @@ def test_openai_format_decisions_translate_through_systemone( assert float(response.headers["x-litellm-response-cost"]) > 0 +@pytest.mark.parametrize( + ("endpoint", "request_body", "upstream_response"), + ( + ("/v1/systemone", _REQUEST, _RESPONSE), + ("/v1/decisions", _OPENAI_FORMAT_REQUEST, _SYSTEMONE_ANSWERS_FOR_OPENAI_REQUEST), + ), + ids=("systemone", "openai_format"), +) +def test_decisions_return_guardrail_information_when_requested( + client: TestClient, + respx_mock: respx.MockRouter, + endpoint: str, + request_body: Mapping[str, object], + upstream_response: Mapping[str, object], +) -> None: + respx_mock.post("https://api.perplexity.ai/v1/decisions").respond(json=upstream_response) + + response: Final = client.post(endpoint, json={**request_body, "include_guardrail_response": True}) + + assert response.status_code == 200, response.text + assert response.json()["guardrail_information"] == [] + + @pytest.mark.parametrize( "request_body", (