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]

_get_bedrock_client_ssl_verify

Ishaan Jaffer29254d907197
diff --git a/litellm/llms/bedrock/common_utils.py b/litellm/llms/bedrock/common_utils.py
index d8e0a05dc01..f4b5de8f7c0 100644
--- a/litellm/llms/bedrock/common_utils.py
+++ b/litellm/llms/bedrock/common_utils.py
@@ -132,6 +132,38 @@ def add_custom_header(headers):
return callback
+def _get_bedrock_client_ssl_verify() -> Union[bool, str]:
+ """
+ Get SSL verification setting for Bedrock client.
+
+ Returns the SSL verification setting which can be:
+ - True: Use default SSL verification
+ - False: Disable SSL verification
+ - str: Path to a custom CA bundle file
+ """
+ from litellm.secret_managers.main import str_to_bool
+
+ ssl_verify: Union[bool, str, None] = os.getenv("SSL_VERIFY", litellm.ssl_verify)
+
+ # Convert string "False"/"True" to boolean
+ if isinstance(ssl_verify, str):
+ # Check if it's a file path
+ if os.path.exists(ssl_verify):
+ return ssl_verify # Keep the file path
+ # Otherwise try to convert to boolean
+ ssl_verify_bool = str_to_bool(ssl_verify)
+ if ssl_verify_bool is not None:
+ ssl_verify = ssl_verify_bool
+
+ # Check SSL_CERT_FILE environment variable for custom CA bundle
+ if ssl_verify is True or ssl_verify == "True":
+ ssl_cert_file = os.getenv("SSL_CERT_FILE")
+ if ssl_cert_file and os.path.exists(ssl_cert_file):
+ return ssl_cert_file
+
+ return ssl_verify if ssl_verify is not None else True
+
+
def init_bedrock_client(
region_name=None,
aws_access_key_id: Optional[str] = None,
@@ -177,27 +209,7 @@ def init_bedrock_client(
aws_web_identity_token,
) = params_to_check
- # SSL certificates (a.k.a CA bundle) used to verify the identity of requested hosts.
- # Use the same logic as BaseAWSLLM._get_ssl_verify() for consistency
- from litellm.secret_managers.main import str_to_bool
- ssl_verify = os.getenv("SSL_VERIFY", litellm.ssl_verify)
-
- # Convert string "False"/"True" to boolean
- if isinstance(ssl_verify, str):
- # Check if it's a file path
- if os.path.exists(ssl_verify):
- pass # Keep the file path
- else:
- # Otherwise try to convert to boolean
- ssl_verify_bool = str_to_bool(ssl_verify)
- if ssl_verify_bool is not None:
- ssl_verify = ssl_verify_bool
-
- # Check SSL_CERT_FILE environment variable for custom CA bundle
- if ssl_verify is True or ssl_verify == "True":
- ssl_cert_file = os.getenv("SSL_CERT_FILE")
- if ssl_cert_file and os.path.exists(ssl_cert_file):
- ssl_verify = ssl_cert_file
+ ssl_verify = _get_bedrock_client_ssl_verify()
### SET REGION NAME
if region_name: