mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
Merge remote-tracking branch 'origin/litellm_systemone_endpoint' into litellm_openai_decisions_provider
# Conflicts: # litellm/proxy/decisions_endpoints/endpoints.py # litellm/types/decisions.py
This commit is contained in:
commit
c19ada66ed
2 changed files with 24 additions and 1 deletions
|
|
@ -320,7 +320,7 @@ class OpenAIDecisionResponse(_HiddenParamsResponse):
|
||||||
answers: tuple[OpenAIDecisionAnswer, ...]
|
answers: tuple[OpenAIDecisionAnswer, ...]
|
||||||
usage: OpenAIDecisionUsage
|
usage: OpenAIDecisionUsage
|
||||||
|
|
||||||
model_config = ConfigDict(frozen=True)
|
model_config = ConfigDict(extra="allow", frozen=True)
|
||||||
|
|
||||||
|
|
||||||
_NO_EXTRA: Final[Mapping[str, object]] = MappingProxyType({})
|
_NO_EXTRA: Final[Mapping[str, object]] = MappingProxyType({})
|
||||||
|
|
|
||||||
|
|
@ -387,6 +387,29 @@ def test_openai_format_decisions_translate_through_systemone(
|
||||||
assert float(response.headers["x-litellm-response-cost"]) > 0
|
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(
|
@pytest.mark.parametrize(
|
||||||
"request_body",
|
"request_body",
|
||||||
(
|
(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue