mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* feat(guardrails): opt-in Bedrock ApplyGuardrail scan of tool-call arguments and tool descriptions as text Tool calls in the request history are scanned as INPUT and model-generated tool calls as OUTPUT on chat completions, messages and responses. scan_tool_descriptions_as_text now accepts bedrock Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): scan decoded tool-call arguments and reject the tool text scans in during_call mode Tool-call arguments are JSON-decoded before the Bedrock scan so escapes cannot hide text, arguments nested too deep to scan are blocked, and both flags are rejected for a Bedrock guardrail running during_call, whose native hook never reaches the scan Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): dedupe tool-call keys before the escape check and assert scanned text in the default-off test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): scan streamed chat completions tool calls on the Bedrock post-call stream hook A tool-call-only /v1/chat/completions stream was assembled and scanned as text only, so scan_tool_calls_as_text never saw the streamed arguments Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(guardrails): type the Bedrock tool-call scan inputs so the typecheck ceilings hold Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): scan custom tool calls in the Bedrock tool-call text scan Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): scan legacy function_call in the Bedrock tool-call text scan; inject the http handler in tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(guardrails): answer the masked tool-call scan test with a masked Bedrock reply Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): type the legacy function_call lookup Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): block a tool call that the Bedrock tool-call text scan masks Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): scan tool-call argument values that a repeated JSON key shadows Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(guardrails): type the tool text scan test parameters and split a two-loop comprehension Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(guardrails): type the stream helpers in the tool text scan tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): read scan_tool_calls_as_text through a helper and type the bedrock post-call hook Reads the new flag through effective_scan_tool_calls_as_text_for_guardrail like the sibling guardrail flags, so guardrail objects without the attribute keep working, types the legacy bedrock post-call hook's request body to clear a new basedpyright error, and regenerates the API schema files for the new field --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| guardrail_hooks | ||
| __init__.py | ||
| test_anthropic_sse.py | ||
| test_auto_router_compression.py | ||
| test_content_filter_path_traversal.py | ||
| test_content_utils.py | ||
| test_custom_code_security.py | ||
| test_deferred_guardrail_logging.py | ||
| test_endpoint_image_scan.py | ||
| test_guardrail_coverage.py | ||
| test_guardrail_endpoints.py | ||
| test_guardrail_helpers.py | ||
| test_guardrail_initializers.py | ||
| test_guardrail_load_balancing.py | ||
| test_guardrail_registry.py | ||
| test_init_guardrails.py | ||
| test_llm_as_a_judge.py | ||
| test_mcp_jwt_signer.py | ||
| test_pillar_guardrails.py | ||
| test_prompt_security_guardrails.py | ||
| test_qostodian_nexus_guardrail.py | ||
| test_usage_endpoints.py | ||
| test_usage_tracking.py | ||