diff --git a/litellm/integrations/gcs_bucket/gcs_bucket.py b/litellm/integrations/gcs_bucket/gcs_bucket.py index 3d99c025711..172185fff25 100644 --- a/litellm/integrations/gcs_bucket/gcs_bucket.py +++ b/litellm/integrations/gcs_bucket/gcs_bucket.py @@ -29,7 +29,7 @@ else: class GCSLoggingConfig(TypedDict): bucket_name: str vertex_instance: VertexBase - path_service_account: str + path_service_account: Optional[str] class GCSBucketLogger(GCSBucketBase): @@ -173,7 +173,7 @@ class GCSBucketLogger(GCSBucketBase): ) bucket_name: str - path_service_account: str + path_service_account: Optional[str] if standard_callback_dynamic_params is not None: verbose_logger.debug("Using dynamic GCS logging") verbose_logger.debug( @@ -193,10 +193,6 @@ class GCSBucketLogger(GCSBucketBase): raise ValueError( "GCS_BUCKET_NAME is not set in the environment, but GCS Bucket is being used as a logging callback. Please set 'GCS_BUCKET_NAME' in the environment." ) - if _path_service_account is None: - raise ValueError( - "GCS_PATH_SERVICE_ACCOUNT is not set in the environment, but GCS Bucket is being used as a logging callback. Please set 'GCS_PATH_SERVICE_ACCOUNT' in the environment." - ) bucket_name = _bucket_name path_service_account = _path_service_account vertex_instance = await self.get_or_create_vertex_instance( @@ -208,10 +204,6 @@ class GCSBucketLogger(GCSBucketBase): raise ValueError( "GCS_BUCKET_NAME is not set in the environment, but GCS Bucket is being used as a logging callback. Please set 'GCS_BUCKET_NAME' in the environment." ) - if self.path_service_account_json is None: - raise ValueError( - "GCS_PATH_SERVICE_ACCOUNT is not set in the environment, but GCS Bucket is being used as a logging callback. Please set 'GCS_PATH_SERVICE_ACCOUNT' in the environment." - ) bucket_name = self.BUCKET_NAME path_service_account = self.path_service_account_json vertex_instance = await self.get_or_create_vertex_instance( @@ -224,7 +216,9 @@ class GCSBucketLogger(GCSBucketBase): path_service_account=path_service_account, ) - async def get_or_create_vertex_instance(self, credentials: str) -> VertexBase: + async def get_or_create_vertex_instance( + self, credentials: Optional[str] + ) -> VertexBase: """ This function is used to get the Vertex instance for the GCS Bucket Logger. It checks if the Vertex instance is already created and cached, if not it creates a new instance and caches it. @@ -233,6 +227,9 @@ class GCSBucketLogger(GCSBucketBase): VertexBase, ) + if credentials is None: + credentials = "IAM_AUTH" + if credentials not in self.vertex_instances: vertex_instance = VertexBase() await vertex_instance._ensure_access_token_async( diff --git a/litellm/integrations/gcs_bucket/gcs_bucket_base.py b/litellm/integrations/gcs_bucket/gcs_bucket_base.py index dac0790b65b..56df3aa8094 100644 --- a/litellm/integrations/gcs_bucket/gcs_bucket_base.py +++ b/litellm/integrations/gcs_bucket/gcs_bucket_base.py @@ -33,7 +33,7 @@ class GCSBucketBase(CustomLogger): async def construct_request_headers( self, - service_account_json: str, + service_account_json: Optional[str], vertex_instance: Optional[VertexBase] = None, ) -> Dict[str, str]: from litellm import vertex_chat_completion diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index f3edf79d019..a54e6a3b6a8 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -5,7 +5,6 @@ model_list: api_key: os.environ/OPENAI_API_KEY api_base: https://exampleopenaiendpoint-production.up.railway.app/ - -general_settings: - alerting: ["slack"] - alerting_threshold: 0.001 +general_settings: + store_model_in_db: true + public_routes: ["LiteLLMRoutes.public_routes", "/spend/calculate", "/model/info"]