litellm/tests/unit/decisions
zoveki fb18c5cb3a
fix(decisions): keep systemone confidence, extra fields and proxy cost on litellm_proxy calls (#53195)
* fix(decisions): keep litellm_proxy calls in the caller's shape and bill the proxy's cost

A systemone call now goes to the proxy's /v1/systemone unchanged, assets and
criteria included, and a decisions call keeps going to /v1/decisions. The
call's cost comes from the proxy's x-litellm-response-cost header, extra
fields such as decision_id reach the caller, and the missing-key error names
LITELLM_PROXY_API_KEY. On the proxy, use_litellm_proxy stays a deployment
setting that a request body cannot set.

(cherry picked from commit c6f2379abe53ca80f221aa99abdbb941efd24962)

* fix(decisions): forward safety_identifier on litellm_proxy systemone calls

The proxy's /v1/systemone accepts safety_identifier, so the systemone hop now sends it instead of refusing the call or dropping the field under drop_params.

(cherry picked from commit 787aa1cc33c2ca3b756bdf24d34b7214734061f3)

* test(decisions): cover the litellm_proxy cost fallback and systemone images

A proxied call with no usable cost header now has to bill the same model price a direct call bills, a zero cost header has to bill zero, and the systemone call has to forward its images

(cherry picked from commit 7c0892dbd2d5b36d814155531e4e76ab54358f0e)

* fix(decisions): pass on proxied answers that carry no confidence

The proxy already checked each answer against its own deployment's provider, so a Parallel AI choice or score answer with no confidence now reaches the caller instead of failing after the proxy billed it

(cherry picked from commit 350afdffcfa4d9a4e1b315a5cc56bb0eb962af9c)

* fix(decisions): ignore use_litellm_proxy in request fallback targets

The decisions endpoints already drop use_litellm_proxy and model_info from the top level of a request body, since both are deployment settings. Fallback targets in the body now drop them too, in fallbacks, context_window_fallbacks, content_policy_fallbacks and the same lists under router_settings_override, so only deployment config turns the flag on

(cherry picked from commit e84aac682fe0920e54d189d2bf3599372cda8952)

* fix(decisions): send the caller's drop_params to the litellm_proxy hop

A proxied decisions or systemone call with drop_params still failed when the proxy's deployment could not take safety_identifier, since the flag stayed on the client. The call now sends drop_params: true to the proxy, which drops what the deployment it picks cannot take

* refactor(decisions): drop the litellm_proxy hop's unreachable missing key message

The hop sets api_key_required to False, which gates the only caller of missing_api_key_message, so the override never ran

* fix(decisions): send only a per-call drop_params to the litellm_proxy hop

A proxy-wide or SDK-wide drop_params went to the upstream proxy on every hop call, so an upstream that is not a LiteLLM proxy refused the unknown parameter. The hop now gets drop_params only when the caller set it on that call, and the global setting stays on the client the way chat through litellm_proxy keeps it

* fix(gemini): name the model on Gemini systemone answers

Gemini's systemone answers carry no model, so a direct call and a litellm_proxy hop answered model null while the decisions shape answered gemini/gemini-decision-1. A Gemini systemone call now fills in the provider and model it was sent to when the answer leaves it out

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-21 12:47:10 -08:00
..
__init__.py
test_call.py fix(decisions): forward OpenAI prompt cache fields (#51457) 2026-11-18 03:25:09 +00:00
test_main.py fix(decisions): keep systemone confidence, extra fields and proxy cost on litellm_proxy calls (#53195) 2026-11-21 12:47:10 -08:00