-
Notifications
You must be signed in to change notification settings - Fork 19
Release v3.8.21 - AWS Bedrock ARN parsing fix #545
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Obinna Okafor <obinna.okafor01@gmail.com>
* fix aws bedrock streaming bug * bump version * add deprecated dependency * restrict current pinecone instrumentation to v6.0.2 * hard code boto3 dependency version
Added support for embeddings via AWS Bedrock
…duplication fix duplicate event stream
* Fix AWS Bedrock ARN parsing issue in converse methods - Replace modelId.split('.') with parse_vendor_and_model_name_from_model_id - Fixes crash when using ARN or cross-region model IDs with multiple dots - Makes patch_converse and patch_converse_stream consistent with other methods Resolves ValueError: too many values to unpack (expected 2) when using: - ARN format: arn:aws:bedrock:us-east-1:<account_id>:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0 - Cross-region format: us.anthropic.claude-sonnet-4-20250514-v1:0 Co-Authored-By: karthik@scale3labs.com <karthik@scale3labs.com> * Bump version to 3.8.21 for ARN parsing bug fix Co-Authored-By: karthik@scale3labs.com <karthik@scale3labs.com> --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: karthik@scale3labs.com <karthik@scale3labs.com>
Co-Authored-By: karthik@scale3labs.com <karthik@scale3labs.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
karthikscale3
approved these changes
Jul 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR fixes a critical bug in the AWS Bedrock instrumentation where
modelId.split(".")
fails when using ARN or cross-region model IDs that contain multiple dots. The issue caused aValueError: too many values to unpack (expected 2)
crash when using model IDs like:arn:aws:bedrock:us-east-1:<account_id>:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0
us.anthropic.claude-sonnet-4-20250514-v1:0
Changes Made
patch_converse_stream
(line 110): Replaced(vendor, _) = modelId.split(".")
withvendor, _ = parse_vendor_and_model_name_from_model_id(modelId)
patch_converse
(line 145): Applied the same fix as abovepatch_invoke_model
andpatch_invoke_model_with_response_stream
Root Cause
The
patch_converse_stream
andpatch_converse
functions assumed model IDs could always be split into exactly 2 parts using dots, but ARNs and cross-region model IDs contain multiple dots. The codebase already had a robustparse_vendor_and_model_name_from_model_id
function that handles these cases correctly, but these two functions weren't using it.Testing
src/tests/aws_bedrock/test_model_id_parsing.py
covers the parser function but couldn't be executed locally.A test script was created that confirmed:
modelId.split(".")
method fails with "too many values to unpack" error for ARN formatsparse_vendor_and_model_name_from_model_id
function handles these cases correctlyReview Checklist
arn:aws:bedrock:us-east-1:123456789012:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0
us.anthropic.claude-sonnet-4-20250514-v1:0
anthropic.claude-3-opus-20240229
Risk Assessment
🔴 High Priority Review: This touches critical path code for AWS Bedrock instrumentation. While the fix is minimal and follows existing patterns in the codebase, thorough testing is essential to prevent regressions.
Link to Devin run: https://app.devin.ai/sessions/9b326f6380504040bf8b711ce512ab94
Requested by: karthik@scale3labs.com