From 8343906d8e9fb968c6adc3aeda69721b3e2c9758 Mon Sep 17 00:00:00 2001 From: uid10804 Date: Mon, 3 Jun 2024 22:02:10 +0200 Subject: [PATCH] fix(bedrock): raise internal error response --- litellm/llms/bedrock_httpx.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/litellm/llms/bedrock_httpx.py b/litellm/llms/bedrock_httpx.py index dd41a8cb75..dbd7e7c695 100644 --- a/litellm/llms/bedrock_httpx.py +++ b/litellm/llms/bedrock_httpx.py @@ -284,7 +284,11 @@ class BedrockLLM(BaseLLM): ) = params_to_check ### CHECK STS ### - if aws_web_identity_token is not None and aws_role_name is not None and aws_session_name is not None: + if ( + aws_web_identity_token is not None + and aws_role_name is not None + and aws_session_name is not None + ): oidc_token = get_secret(aws_web_identity_token) if oidc_token is None: @@ -293,9 +297,7 @@ class BedrockLLM(BaseLLM): status_code=401, ) - sts_client = boto3.client( - "sts" - ) + sts_client = boto3.client("sts") # https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sts/client/assume_role_with_web_identity.html @@ -1007,7 +1009,7 @@ class BedrockLLM(BaseLLM): response.raise_for_status() except httpx.HTTPStatusError as err: error_code = err.response.status_code - raise BedrockError(status_code=error_code, message=response.text) + raise BedrockError(status_code=error_code, message=err.response.text) except httpx.TimeoutException as e: raise BedrockError(status_code=408, message="Timeout error occurred.")