From dd9884ef271b2c1e069cb8d5c70553d84289582c Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Mon, 29 Jun 2026 11:12:02 +0530 Subject: [PATCH] address greptile review feedback (greploop iteration 2) - bias_hallucination_estimator: forward all session options to GuardrailSessionConfig - gemini: guard null text in _extract_audio_response_from_parts Co-Authored-By: Claude Sonnet 4.6 --- .../vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py | 2 +- .../guardrail_hooks/bias_hallucination_estimator/__init__.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index 818dc8d45f0..ff50a526b0f 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -1543,7 +1543,7 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): if "text" in part: text_content = part["text"] # Check if text content contains audio data URI - if text_content.startswith("data:audio") and ";base64," in text_content: + if text_content is not None and text_content.startswith("data:audio") and ";base64," in text_content: try: if is_base64_encoded(text_content): media_type, audio_data = text_content.split("data:")[1].split(";base64,") diff --git a/litellm/proxy/guardrails/guardrail_hooks/bias_hallucination_estimator/__init__.py b/litellm/proxy/guardrails/guardrail_hooks/bias_hallucination_estimator/__init__.py index 298ed6b7b56..8473cb97591 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/bias_hallucination_estimator/__init__.py +++ b/litellm/proxy/guardrails/guardrail_hooks/bias_hallucination_estimator/__init__.py @@ -46,6 +46,11 @@ def initialize_guardrail( ), session=GuardrailSessionConfig( violation_message_template=getattr(litellm_params, "violation_message_template", None), + mask_request_content=getattr(litellm_params, "mask_request_content", False), + mask_response_content=getattr(litellm_params, "mask_response_content", False), + end_session_after_n_fails=getattr(litellm_params, "end_session_after_n_fails", None), + on_violation=getattr(litellm_params, "on_violation", None), + realtime_violation_message=getattr(litellm_params, "realtime_violation_message", None), ), ), )