Skip to content

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]

Changes to fix frequency_penalty and presence_penalty issue for gemini-2.5-pro model (#16041)

tanvithakurbb79a75a89cf
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 fdad7851f1e..112d3783787 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
@@ -220,11 +220,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
def _supports_penalty_parameters(self, model: str) -> bool:
unsupported_models = ["gemini-2.5-pro-preview-06-05"]
-
- for pattern in unsupported_models:
- if model in pattern:
- return False
-
+ if model in unsupported_models:
+ return False
return True
def get_supported_openai_params(self, model: str) -> List[str]:
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py
index eaf2c6c4ffe..dbd795e1b31 100644
--- a/litellm/proxy/utils.py
+++ b/litellm/proxy/utils.py
@@ -985,7 +985,7 @@ class ProxyLogging:
)
else:
_callback = callback # type: ignore
- if _callback is not None and isinstance(_callback, CustomGuardrail):
+ if _callback is not None and isinstance(_callback, CustomGuardrail) and data is not None:
result = await self._process_guardrail_callback(
callback=_callback,
data=data,