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]

fix - don't require boto3 on the cli

Ishaan Jaff5f693971f743
diff --git a/litellm/proxy/common_utils/load_config_utils.py b/litellm/proxy/common_utils/load_config_utils.py
index bded2e34704..6548187147c 100644
--- a/litellm/proxy/common_utils/load_config_utils.py
+++ b/litellm/proxy/common_utils/load_config_utils.py
@@ -1,27 +1,26 @@
-import tempfile
-
-import boto3
import yaml
from litellm._logging import verbose_proxy_logger
def get_file_contents_from_s3(bucket_name, object_key):
- # v0 rely on boto3 for authentication - allowing boto3 to handle IAM credentials etc
- from botocore.config import Config
- from botocore.credentials import Credentials
+ try:
+ # v0 rely on boto3 for authentication - allowing boto3 to handle IAM credentials etc
+ import tempfile
- from litellm.main import bedrock_converse_chat_completion
+ import boto3
+ from botocore.config import Config
+ from botocore.credentials import Credentials
- credentials: Credentials = bedrock_converse_chat_completion.get_credentials()
- s3_client = boto3.client(
- "s3",
- aws_access_key_id=credentials.access_key,
- aws_secret_access_key=credentials.secret_key,
- aws_session_token=credentials.token, # Optional, if using temporary credentials
- )
+ from litellm.main import bedrock_converse_chat_completion
- try:
+ credentials: Credentials = bedrock_converse_chat_completion.get_credentials()
+ s3_client = boto3.client(
+ "s3",
+ aws_access_key_id=credentials.access_key,
+ aws_secret_access_key=credentials.secret_key,
+ aws_session_token=credentials.token, # Optional, if using temporary credentials
+ )
verbose_proxy_logger.debug(
f"Retrieving {object_key} from S3 bucket: {bucket_name}"
)
@@ -43,6 +42,9 @@ def get_file_contents_from_s3(bucket_name, object_key):
config = yaml.safe_load(yaml_file)
return config
+ except ImportError:
+ # this is most likely if a user is not using the litellm docker container
+ pass
except Exception as e:
verbose_proxy_logger.error(f"Error retrieving file contents: {str(e)}")
return None