diff --git a/litellm/google_genai/main.py b/litellm/google_genai/main.py index 403369c8f66..ba7222c041d 100644 --- a/litellm/google_genai/main.py +++ b/litellm/google_genai/main.py @@ -17,7 +17,6 @@ from litellm.llms.base_llm.google_genai.transformation import ( BaseGoogleGenAIGenerateContentConfig, ) from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler -from litellm.llms.vertex_ai.vertex_llm_base import VertexBase from litellm.types.router import GenericLiteLLMParams from litellm.types.utils import CallTypes from litellm.utils import ProviderConfigManager, client @@ -199,7 +198,7 @@ class GenerateContentHelper: optional_params=dict(generate_content_config_dict), litellm_params={ "litellm_call_id": litellm_call_id, - "vertex_location": VertexBase.explicit_vertex_ai_location(litellm_params.model_dump()), + **generate_content_provider_config.get_generate_content_logging_params(litellm_params), }, custom_llm_provider=custom_llm_provider, ) diff --git a/litellm/llms/base_llm/google_genai/transformation.py b/litellm/llms/base_llm/google_genai/transformation.py index bd0d29d5ea3..7e85d6ccf80 100644 --- a/litellm/llms/base_llm/google_genai/transformation.py +++ b/litellm/llms/base_llm/google_genai/transformation.py @@ -1,5 +1,6 @@ import types from abc import ABC, abstractmethod +from collections.abc import Mapping from typing import TYPE_CHECKING, Any import httpx @@ -73,6 +74,9 @@ class BaseGoogleGenAIGenerateContentConfig(ABC): """ return ("safetySettings", "toolConfig", "cachedContent", "labels") + def get_generate_content_logging_params(self, litellm_params: GenericLiteLLMParams) -> Mapping[str, object]: + return types.MappingProxyType({}) + @abstractmethod def map_generate_content_optional_params( self, diff --git a/litellm/llms/vertex_ai/google_genai/transformation.py b/litellm/llms/vertex_ai/google_genai/transformation.py index 8c22ae06af0..cbbed2134f9 100644 --- a/litellm/llms/vertex_ai/google_genai/transformation.py +++ b/litellm/llms/vertex_ai/google_genai/transformation.py @@ -2,6 +2,8 @@ Transformation for Calling Google models in their native format. """ +from collections.abc import Mapping +from types import MappingProxyType from typing import Any, Final, Literal from litellm.llms.gemini.google_genai.transformation import GoogleGenAIConfig @@ -20,6 +22,9 @@ class VertexAIGoogleGenAIConfig(GoogleGenAIConfig): def custom_llm_provider(self) -> Literal["gemini", "vertex_ai"]: return "vertex_ai" + def get_generate_content_logging_params(self, litellm_params: GenericLiteLLMParams) -> Mapping[str, object]: + return MappingProxyType({"vertex_location": self.explicit_vertex_ai_location(litellm_params.model_dump())}) + def validate_environment( self, api_key: str | None,