Fix AWS Bedrock ARN parsing issue in converse methods#544
Merged
karthikscale3 merged 2 commits intodevelopmentfrom Jul 24, 2025
Merged
Fix AWS Bedrock ARN parsing issue in converse methods#544karthikscale3 merged 2 commits intodevelopmentfrom
karthikscale3 merged 2 commits intodevelopmentfrom
Conversation
- 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>
Contributor
Author
🤖 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:
|
Co-Authored-By: karthik@scale3labs.com <karthik@scale3labs.com>
karthikscale3
approved these changes
Jul 24, 2025
karthikscale3
added a commit
that referenced
this pull request
Jul 24, 2025
* capture different types of google genai inputs (#534) Co-authored-by: Obinna Okafor <obinna.okafor01@gmail.com> * Read stream before saving attributes. Parse modelId in a more robust way. * Decide based on model name on the set of attributes tracked. * Added basic test for model ID parsing. * Added replay tests for AWS Bedrock. * Added test for streaming requests too. * Obinna/fix awsbedrock streaming response (#538) * fix aws bedrock streaming bug * bump version * add deprecated dependency * restrict current pinecone instrumentation to v6.0.2 * hard code boto3 dependency version * fix duplicate event stream * set test aws key * Fix AWS Bedrock ARN parsing issue in converse methods (#544) * 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: obinnascale3 <109410793+obinnascale3@users.noreply.github.com> Co-authored-by: Obinna Okafor <obinna.okafor01@gmail.com> Co-authored-by: m1kl0sh <miklos.erdelyi@moduscreate.com> Co-authored-by: Obinna Okafor <obinna@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>
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
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
Fixes AWS Bedrock instrumentation crash when using ARN or cross-region model IDs that contain multiple dots. The issue occurred in
patch_converse_streamandpatch_conversefunctions wheremodelId.split(".")assumed exactly 2 parts, but ARNs and cross-region IDs have multiple dots, causingValueError: too many values to unpack (expected 2).Problem:
Solution:
Replaced the problematic split calls with the existing robust
parse_vendor_and_model_name_from_model_id()function that already handles ARNs correctly and is used consistently in other methods likepatch_invoke_model.Changes Made
(vendor, _) = modelId.split(".")withvendor, _ = parse_vendor_and_model_name_from_model_id(modelId)inpatch_converse_streampatch_conversefunctionKey Review Points
Test with actual ARN formats: The existing test suite covers the parser function, but please test the full instrumentation pipeline with:
arn:aws:bedrock:us-east-1:<account_id>:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0us.anthropic.claude-sonnet-4-20250514-v1:0Behavioral consistency: Confirm that
parse_vendor_and_model_name_from_model_id()returns compatible values for all model ID formats that the original split logic handledRun existing test suite: I couldn't run the full test suite locally due to missing dependencies, so please verify no regressions with:
Testing Evidence
Created test script that reproduces the original error:
Checklist for bug fix:
Link to Devin run: https://app.devin.ai/sessions/9b326f6380504040bf8b711ce512ab94
Requested by: karthik@scale3labs.com
Risk Assessment: Low-risk change (2 lines) but affects core functionality. The existing parser is well-tested, but human verification of compatibility is essential since I couldn't run the full test suite locally.