From 1fde2579bf6cbfa4a92deb4c462bbaf3c96e21f9 Mon Sep 17 00:00:00 2001 From: Xiaohan Fu Date: Fri, 30 Jan 2026 22:46:11 +0000 Subject: [PATCH] add logger when model response has no choices for streaming /response and /messages --- litellm/llms/anthropic/chat/guardrail_translation/handler.py | 2 ++ litellm/llms/openai/responses/guardrail_translation/handler.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index 6f502e9870b..656eab5c17b 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -395,6 +395,8 @@ class AnthropicMessagesHandler(BaseTranslation): input_type="response", logging_obj=litellm_logging_obj, ) + else: + verbose_proxy_logger.debug("Skipping output guardrail - model response has no choices") return responses_so_far string_so_far = self.get_streaming_string_so_far(responses_so_far) diff --git a/litellm/llms/openai/responses/guardrail_translation/handler.py b/litellm/llms/openai/responses/guardrail_translation/handler.py index 523becfd89a..ad3d4c932d4 100644 --- a/litellm/llms/openai/responses/guardrail_translation/handler.py +++ b/litellm/llms/openai/responses/guardrail_translation/handler.py @@ -447,6 +447,8 @@ class OpenAIResponsesHandler(BaseTranslation): logging_obj=litellm_logging_obj, ) return responses_so_far + else: + verbose_proxy_logger.debug("Skipping output guardrail - model response has no choices") # model_response_stream = OpenAiResponsesToChatCompletionStreamIterator.translate_responses_chunk_to_openai_stream(final_chunk) # tool_calls = model_response_stream.choices[0].tool_calls # convert openai response to model response