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
feat(vertex): Use correct provider for response_schema support check (#5815) (#5829)
Krish Dholakia4911979c61ad
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/common_utils.py b/litellm/llms/vertex_ai_and_google_ai_studio/common_utils.pyindex 8604d03836f..0649b93ea81 100644--- a/litellm/llms/vertex_ai_and_google_ai_studio/common_utils.py+++ b/litellm/llms/vertex_ai_and_google_ai_studio/common_utils.py@@ -2,7 +2,7 @@ from typing import List, Literal, Tupleimport httpx-from litellm import supports_system_messages, verbose_logger+from litellm import supports_system_messages, supports_response_schema, verbose_loggerfrom litellm.types.llms.vertex_ai import PartType@@ -40,6 +40,20 @@ def get_supports_system_message(return supports_system_message+def get_supports_response_schema(+ model: str, custom_llm_provider: Literal["vertex_ai", "vertex_ai_beta", "gemini"]+) -> bool:+ _custom_llm_provider = custom_llm_provider+ if custom_llm_provider == "vertex_ai_beta":+ _custom_llm_provider = "vertex_ai"++ _supports_response_schema = supports_response_schema(+ model=model, custom_llm_provider=_custom_llm_provider+ )++ return _supports_response_schema++from typing import Literal, Optionalall_gemini_url_modes = Literal["chat", "embedding", "batch_embedding"]diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.pyindex 2dc8a013521..78874d544ed 100644--- a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py+++ b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py@@ -22,7 +22,7 @@ from litellm.types.llms.vertex_ai import (Tools,)-from ..common_utils import get_supports_system_message+from ..common_utils import get_supports_system_message, get_supports_response_schemafrom ..vertex_ai_non_gemini import _gemini_convert_messages_with_history@@ -46,8 +46,8 @@ def _transform_request_body()# Checks for 'response_schema' support - if passed inif "response_schema" in optional_params:- supports_response_schema = litellm.supports_response_schema(- model=model, custom_llm_provider="vertex_ai"+ supports_response_schema = get_supports_response_schema(+ model=model, custom_llm_provider=custom_llm_provider)if supports_response_schema is False:user_response_schema_message = response_schema_prompt(