-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: AWS region name error when passing user bedrock client #1292
Labels
bug
Something isn't working
Comments
Nice! |
will close once we have a release out |
I can repro this error with our test too, needed to update our test for this scenario LiteLLM.Info: If you need to debug this error, use `litellm.set_verbose=True'.
Traceback (most recent call last):
File "/Users/ishaanjaffer/Github/litellm/litellm/main.py", line 1429, in completion
response = bedrock.completion(
File "/Users/ishaanjaffer/Github/litellm/litellm/llms/bedrock.py", line 641, in completion
raise e
File "/Users/ishaanjaffer/Github/litellm/litellm/llms/bedrock.py", line 427, in completion
client = optional_params.pop("aws_bedrock_client", init_bedrock_client(
File "/Users/ishaanjaffer/Github/litellm/litellm/llms/bedrock.py", line 325, in init_bedrock_client
raise BedrockError(
litellm.llms.bedrock.BedrockError: AWS region not set: set AWS_REGION_NAME or AWS_REGION env variable or in .env file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ishaanjaffer/Github/litellm/litellm/tests/test_completion.py", line 1552, in test_completion_bedrock_claude_external_client_auth
response = completion(
File "/Users/ishaanjaffer/Github/litellm/litellm/utils.py", line 2113, in wrapper
raise e
File "/Users/ishaanjaffer/Github/litellm/litellm/utils.py", line 2020, in wrapper
result = original_function(*args, **kwargs)
File "/Users/ishaanjaffer/Github/litellm/litellm/main.py", line 1743, in completion
raise exception_type(
File "/Users/ishaanjaffer/Github/litellm/litellm/utils.py", line 6375, in exception_type
raise e
File "/Users/ishaanjaffer/Github/litellm/litellm/utils.py", line 5629, in exception_type
raise AuthenticationError(
litellm.exceptions.AuthenticationError: BedrockException - AWS region not set: set AWS_REGION_NAME or AWS_REGION env variable or in .env file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ishaanjaffer/Github/litellm/litellm/tests/test_completion.py", line 1569, in <module>
test_completion_bedrock_claude_external_client_auth()
File "/Users/ishaanjaffer/Github/litellm/litellm/tests/test_completion.py", line 1568, in test_completion_bedrock_claude_external_client_auth
pytest.fail(f"Error occurred: {e}")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pytest/outcomes.py", line 198, in fail
raise Failed(msg=reason, pytrace=pytrace)
Failed: Error occurred: BedrockException - AWS region not set: set AWS_REGION_NAME or AWS_REGION env variable or in .env file |
testing for bedrock here too now: 18ef244 We test passing the boto3 client |
will close this issue once we have a new deploy |
Fixed in litellm 1.16.9+ @dleen closing this issue, feel free to re-open if not fixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
First, thanks for this great project!
When passing my own bedrock client:
I get the error:
adding:
fixes the issue but obviously should not be needed since the client defines the region.
It seems like the issue is due to a function call being used as the default value when calling
pop
on the optional params dict. Maybe the assumption is that the default value is not evaluated unless needed? But the function is being called regardless if the default is used or not.My suggestion for a fix is to just call pop without a default and then examine it for
None
and then call the function. I'll make this change if you agree with the approach.Relevant log output
No response
Twitter / LinkedIn details
No response
The text was updated successfully, but these errors were encountered: