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]

Merge branch 'main' into litellm_vertex_migration

Krish Dholakiaf27abe046213
diff --cc litellm/__init__.py
index 6a8a2875766,e5333211e39..bda12e5ddd6
--- a/litellm/__init__.py
+++ b/litellm/__init__.py
@@@ -830,14 -848,10 +848,14 @@@ from .llms.gemini import GeminiConfi
from .llms.nlp_cloud import NLPCloudConfig
from .llms.aleph_alpha import AlephAlphaConfig
from .llms.petals import PetalsConfig
-from .llms.vertex_httpx import VertexGeminiConfig, GoogleAIStudioGeminiConfig
-from .llms.vertex_ai import VertexAIConfig, VertexAITextEmbeddingConfig
+from .llms.vertex_httpx import (
+ VertexGeminiConfig,
+ GoogleAIStudioGeminiConfig,
+ VertexAIConfig,
+)
+from .llms.vertex_ai import VertexAITextEmbeddingConfig
from .llms.vertex_ai_anthropic import VertexAIAnthropicConfig
- from .llms.vertex_ai_llama import VertexAILlama3Config
+ from .llms.vertex_ai_partner import VertexAILlama3Config
from .llms.sagemaker import SagemakerConfig
from .llms.ollama import OllamaConfig
from .llms.ollama_chat import OllamaChatConfig
diff --cc litellm/utils.py
index 0f52df63c81,af602584556..61beabe9551
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@@ -3041,29 -3180,22 +3180,27 @@@ def get_optional_params
or model in litellm.vertex_text_models
or model in litellm.vertex_code_text_models
or model in litellm.vertex_language_models
- or model in litellm.vertex_embedding_models
or model in litellm.vertex_vision_models
):
- print_verbose(f"(start) INSIDE THE VERTEX AI OPTIONAL PARAM BLOCK")
## check if unsupported param passed in
supported_params = get_supported_openai_params(
model=model, custom_llm_provider=custom_llm_provider
)
_check_valid_arg(supported_params=supported_params)
- optional_params = litellm.VertexAIConfig().map_openai_params(
+ optional_params = litellm.VertexGeminiConfig().map_openai_params(
non_default_params=non_default_params,
optional_params=optional_params,
+ model=model,
+ drop_params=(
+ drop_params
+ if drop_params is not None and isinstance(drop_params, bool)
+ else False
+ ),
)
- print_verbose(
- f"(end) INSIDE THE VERTEX AI OPTIONAL PARAM BLOCK - optional_params: {optional_params}"
- )
+ if litellm.vertex_ai_safety_settings is not None:
+ optional_params["safety_settings"] = litellm.vertex_ai_safety_settings
elif custom_llm_provider == "gemini":
supported_params = get_supported_openai_params(
model=model, custom_llm_provider=custom_llm_provider