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
Merge pull request #38722 from BerriAI/litellm_bedrock_guardrail_stream_audit
Mateo Wang4ba851713481
diff --cc litellm/llms/anthropic/chat/guardrail_translation/handler.pyindex 0d123bc1004,b09b51167d0..eb6dbd3e5b3--- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py+++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py@@@ -204,9 -164,22 +206,22 @@@ class AnthropicMessagesHandler(BaseTranwould make Anthropic clients reject the stream."""if stream_started:- return self._block_continuation_chunks(exc, responses_so_far or [])+ return list(self._block_continuation_chunks(exc, responses_so_far or []))return self._standalone_block_chunks(exc)+ def build_stream_error_items(+ self,+ exc: "HTTPException",+ responses_so_far: Sequence[Any] | None = None,+ ) -> Sequence[Any] | None:+ from litellm.proxy.common_request_processing import (+ serialize_http_exception_detail,+ )+ from litellm.proxy.guardrails.anthropic_sse import anthropic_sse_error_frames++ message, _ = serialize_http_exception_detail(exc.detail)+ return tuple(anthropic_sse_error_frames(message))+def _standalone_block_chunks(self, exc: "ModifyResponseException") -> list[bytes]:import uuid