litellm/litellm/types
Mateo Wang 41210f8f7b
feat(guardrails): opt-in Bedrock scan of tool-call arguments and tool descriptions as text (#52999)
* 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>
2026-11-20 08:08:19 +00:00
..
containers refactor(types): replace Any with proven types in 24 files (#46663) 2026-10-15 06:10:12 -07:00
google_genai refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
images refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
integrations feat(proxy): emit budget alerts for app customer scopes (#52955) 2026-11-19 16:21:09 -08:00
interactions chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
litellm_core_utils fix(streaming): keep an explicit provider prompt_tokens=0 or completion_tokens=0 in streamed usage 2026-09-21 14:01:08 -07:00
llms feat(tts)!: stream audio from the provider as it arrives on /v1/audio/speech (#46222) 2026-11-17 15:03:12 +00:00
management_endpoints feat(shadow-eval): add optional rubric grades (#52321) 2026-11-17 12:04:31 -08:00
mcp_server feat(mcp): cache upstream tool lists with an admin-set lifetime (#51160) 2026-11-12 08:48:04 -08:00
passthrough_endpoints fix(proxy): bill anthropic pass-through calls at the deployment's custom price (#51267) 2026-11-11 17:12:51 -08:00
prompts refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
proxy feat(usage-export): include key and user metadata objects in daily activity export rows (#49360) 2026-11-20 03:58:01 +00:00
repositories feat(usage-export): include key and user metadata objects in daily activity export rows (#49360) 2026-11-20 03:58:01 +00:00
responses fix(responses): replay Claude tool search on follow-up turns (#50821) 2026-11-10 17:13:40 +00:00
secret_managers feat(secret_managers): support customer-managed KMS key for virtual keys stored in AWS Secrets Manager (#40475) 2026-09-11 09:54:08 -07:00
videos feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
access_group.py feat(access-groups): name group vector stores and list them on team info (#51484) 2026-11-13 07:53:04 -08:00
adapter.py refactor(types): import CustomLogger and CustomLLM under TYPE_CHECKING in adapter TypedDicts (#45774) 2026-10-10 19:07:11 +00:00
agents.py fix(gemini)!: accept Google's current Managed Agents fields on create and interactions (#48750) 2026-10-28 12:37:59 -07:00
caching.py chore(caching)!: remove the disk cache backend (#48114) 2026-10-29 18:02:31 -07:00
completion.py refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
compression.py chore(lint): remove litellm/types from the ruff lint exclusion 2026-08-05 01:10:15 -07:00
decisions.py fix(decisions): forward OpenAI prompt cache fields (#51457) 2026-11-18 03:25:09 +00:00
embedding.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
extraction.py refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
files.py fix(bedrock): send s3:// image, document and video URLs to Converse as S3 sources (#50577) 2026-11-13 21:33:21 -08:00
fine_tuning.py
guardrail_base_init.py refactor(types): replace Any with real types across 54 more backend files 2026-08-29 19:00:43 +00:00
guardrails.py feat(guardrails): opt-in Bedrock scan of tool-call arguments and tool descriptions as text (#52999) 2026-11-20 08:08:19 +00:00
lar1.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
litellm_params.py fix(caching): preserve otel cache hits and align logging metadata (#52971) 2026-11-19 16:25:26 -08:00
mcp.py chore: move ui and vscode-extension under litellm and delete docs (#50992) 2026-11-12 04:19:57 +00:00
memory_management.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
model_insights.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
object_permission.py feat(proxy): app-scoped read access to Customer Management through object permissions (#52781) 2026-11-19 10:43:41 -08:00
policy_engine.py chore(lint): remove litellm/types from the ruff lint exclusion 2026-08-05 01:10:15 -07:00
rag.py refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
realtime.py feat(realtime)!: support latest OpenAI audio models (#35600) 2026-11-03 07:27:52 +00:00
rerank.py fix(rerank): preserve token usage in spend logs (#49308) 2026-10-30 13:46:27 -07:00
roi_calculator.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
roi_observed.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
router.py feat(router): select conversation headers for session affinity (#52193) 2026-11-16 21:37:48 -08:00
router_weights.py fix(router): honor team and key provider weights 2026-09-14 23:31:52 -07:00
scheduler.py Squashed commit of the following: (#9709) 2025-04-02 21:24:54 -07:00
search.py fix(cost): price AgentCore web search at $7 per 1,000 queries (#46571) 2026-10-14 18:30:39 -07:00
services.py feat(proxy): enforce customer org, team and member budgets and limits on the request path (#51489) 2026-11-12 20:43:44 -08:00
tag_management.py feat(tags): reset a tag's spend through /tag/update (#50323) 2026-11-06 10:41:22 -08:00
token_count.py feat(bedrock): route token counts from model metadata (#47441) 2026-10-19 21:36:13 -07:00
tool_management.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
utils.py fix(cost): bill priority rates for image input and cached image tokens (#52972) 2026-11-19 15:56:24 -08:00
vector_store_files.py refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
vector_stores.py fix(bedrock): map OpenAI vector store search filters to AWS RetrievalFilter (#51291) 2026-11-14 13:39:43 -05:00
workload_identity.py feat(anthropic): workload identity federation and pluggable identity sources (#44448) 2026-10-03 17:08:30 -07:00