litellm/tests/unit/proxy/guardrails
Sean Yasnogorodski da4f805d51
fix(guardrails): stop the alice guardrail sending each prompt four times (#51392)
* fix(guardrails): stop the alice guardrail sending each prompt four times

request_data repeated the conversation that inputs already carries. The
proxy's proxy_server_request snapshot is no longer forwarded, and
messages are left out when structured_messages is populated, which is
the only time Alice falls back to them. Keys are omitted inside
_json_safe so a cycle back to request_data cannot resend them.

* test(guardrails): annotate the alice request data test variables as Final

AGENTS.md requires every variable to be declared Final (LIT010). Apply it
to the module constants and test locals added for the request_data dedupe.

* fix(guardrails): stop the alice guardrail resending the responses input

When structured_messages is a non-empty list it already carries the
/v1/responses input, with instructions as its leading system message, so
request_data now leaves out input and instructions under the same
condition as messages. Without a parsed conversation both are kept.
2026-11-17 18:13:42 -08:00
..
guardrail_hooks fix(guardrails): stop the alice guardrail sending each prompt four times (#51392) 2026-11-17 18:13:42 -08:00
__init__.py
test_anthropic_sse.py fix(guardrails)!: keep the upstream error when a /v1/messages stream ends in one (#49088) 2026-10-31 02:56:20 -07:00
test_auto_router_compression.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_content_filter_path_traversal.py
test_content_utils.py fix(guardrails): skip embeddings input in google_text_moderation (#48934) 2026-10-28 20:05:03 -07:00
test_custom_code_security.py
test_deferred_guardrail_logging.py fix(logging): retain streaming success logging tasks until they finish (#52067) 2026-11-16 11:21:05 -08:00
test_endpoint_image_scan.py feat(guardrails): scan an image on /apply_guardrail with a Bedrock guardrail (#51016) 2026-11-17 18:13:28 +00:00
test_guardrail_coverage.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
test_guardrail_endpoints.py feat(guardrails): scan an image on /apply_guardrail with a Bedrock guardrail (#51016) 2026-11-17 18:13:28 +00:00
test_guardrail_helpers.py fix(proxy): reject unknown guardrail names on key, user, team and project writes (#51080) 2026-11-11 19:28:45 -08:00
test_guardrail_initializers.py
test_guardrail_load_balancing.py
test_guardrail_registry.py feat(guardrails): add the CollieAi guardrail integration (#49224) 2026-11-12 01:05:12 +00:00
test_init_guardrails.py
test_llm_as_a_judge.py
test_mcp_jwt_signer.py fix(mcp)!: forward the LiteLLM key when the admin configures it (#50604) 2026-11-10 20:51:34 -08:00
test_pillar_guardrails.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_prompt_security_guardrails.py fix(anthropic)!: send /v1/messages PDF documents to OpenAI-shaped providers as file parts (#47166) 2026-10-29 08:06:12 -07:00
test_qostodian_nexus_guardrail.py
test_usage_endpoints.py
test_usage_tracking.py feat(accounting): add opt-in SpendLogs ledger (#49856) 2026-11-04 17:49:15 -08:00