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
use helper to get_config_file_contents_from_gcs
Ishaan Jaff051ac50fcace
diff --git a/litellm/proxy/common_utils/load_config_utils.py b/litellm/proxy/common_utils/load_config_utils.pyindex b009695b8ce..598ac835ea0 100644--- a/litellm/proxy/common_utils/load_config_utils.py+++ b/litellm/proxy/common_utils/load_config_utils.py@@ -42,7 +42,7 @@ def get_file_contents_from_s3(bucket_name, object_key):config = yaml.safe_load(yaml_file)return config- except ImportError:+ except ImportError as e:# this is most likely if a user is not using the litellm docker containerverbose_proxy_logger.error(f"ImportError: {str(e)}")pass@@ -51,6 +51,25 @@ def get_file_contents_from_s3(bucket_name, object_key):return None+async def get_config_file_contents_from_gcs(bucket_name, object_key):+ try:+ from litellm.integrations.gcs_bucket import GCSBucketLogger++ gcs_bucket = GCSBucketLogger(+ bucket_name=bucket_name,+ )+ file_contents = await gcs_bucket.download_gcs_object(object_key)+ # file_contentis is a bytes object, so we need to convert it to yaml+ file_contents = file_contents.decode("utf-8")+ # convert to yaml+ config = yaml.safe_load(file_contents)+ return config++ except:+ verbose_proxy_logger.error(f"Error retrieving file contents: {str(e)}")+ return None++# # Example usage# bucket_name = 'litellm-proxy'# object_key = 'litellm_proxy_config.yaml'