Use bedrock_client region for Bedrock model ARN to prevent cross-region reranking errors #141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available: N/A
Description of changes:
This pull request updates the construction of the Bedrock model ARN in
builtin_tools/aws/tools/bedrock_retrieve.py
(line 36) to use the region frombedrock_client
instead of the previously hardcodedus-west-2
.When running in a region different from
us-west-2
, using a hardcoded region causes the error:"Reranking does not support cross-region calls. Please provide a valid model ARN."
By dynamically using
self.bedrock_client.meta.region_name
for the ARN's region, the reranking operation will always use the same region as the client, preventing cross-region errors and improving compatibility across different AWS regions.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.