The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
return traces in bedrock guardrails when enabled
Ishaan Jaff9851fa7b1b3c
diff --git a/litellm/utils.py b/litellm/utils.pyindex 414550be485..d915690fc6e 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -10226,6 +10226,14 @@ class CustomStreamWrapper:returnelif self.received_finish_reason is not None:if self.sent_last_chunk is True:+ # Bedrock returns the guardrail trace in the last chunk - we want to return this here+ if (+ self.custom_llm_provider == "bedrock"+ and "trace" in model_response+ ):+ return model_response++ # Default - return StopIterationraise StopIteration# flush any remaining holding chunkif len(self.holding_chunk) > 0: