Skip to content

Commit 33bf494

Browse files
committed
fix: update outdated document url of exception note
1 parent 94fc8dd commit 33bf494

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/strands/models/bedrock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,13 +875,13 @@ def _stream(
875875
add_exception_note(e, f"└ Model id: {self.config.get('model_id')}")
876876

877877
if (
878-
e.response["Error"]["Code"] == "AccessDeniedException"
879-
and "You don't have access to the model" in error_message
878+
e.response["Error"]["Code"] == "ValidationException"
879+
and "The provided model identifier is invalid" in error_message
880880
):
881881
add_exception_note(
882882
e,
883883
"└ For more information see "
884-
"https://strandsagents.com/latest/user-guide/concepts/model-providers/amazon-bedrock/#model-access-issue",
884+
"https://strandsagents.com/docs/user-guide/concepts/model-providers/amazon-bedrock/#model-identifier-is-invalid",
885885
)
886886

887887
if (
@@ -891,7 +891,7 @@ def _stream(
891891
add_exception_note(
892892
e,
893893
"└ For more information see "
894-
"https://strandsagents.com/latest/user-guide/concepts/model-providers/amazon-bedrock/#on-demand-throughput-isnt-supported",
894+
"https://strandsagents.com/docs/user-guide/concepts/model-providers/amazon-bedrock/#on-demand-throughput-isnt-supported",
895895
)
896896

897897
raise e

tests/strands/models/test_bedrock.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,14 +1479,14 @@ async def test_no_add_note_when_not_available(bedrock_client, model, alist, mess
14791479

14801480
@pytest.mark.skipif(sys.version_info < (3, 11), reason="This test requires Python 3.11 or higher (need add_note)")
14811481
@pytest.mark.asyncio
1482-
async def test_add_note_on_access_denied_exception(bedrock_client, model, alist, messages):
1483-
"""Test that add_note adds documentation link for AccessDeniedException."""
1482+
async def test_add_note_on_validation_exception_identifier(bedrock_client, model, alist, messages):
1483+
"""Test that add_note adds documentation link for ValidationException about invalid model identifier."""
14841484
# Mock the client error response for access denied
14851485
error_response = {
14861486
"Error": {
1487-
"Code": "AccessDeniedException",
1488-
"Message": "An error occurred (AccessDeniedException) when calling the ConverseStream operation: "
1489-
"You don't have access to the model with the specified model ID.",
1487+
"Code": "ValidationException",
1488+
"Message": "An error occurred (ValidationException) when calling the ConverseStream operation: "
1489+
"The provided model identifier is invalid.",
14901490
}
14911491
}
14921492
bedrock_client.converse_stream.side_effect = ClientError(error_response, "ConversationStream")
@@ -1499,7 +1499,7 @@ async def test_add_note_on_access_denied_exception(bedrock_client, model, alist,
14991499
"└ Bedrock region: us-west-2",
15001500
"└ Model id: m1",
15011501
"└ For more information see "
1502-
"https://strandsagents.com/latest/user-guide/concepts/model-providers/amazon-bedrock/#model-access-issue",
1502+
"https://strandsagents.com/docs/user-guide/concepts/model-providers/amazon-bedrock/#model-identifier-is-invalid",
15031503
]
15041504

15051505

@@ -1527,7 +1527,7 @@ async def test_add_note_on_validation_exception_throughput(bedrock_client, model
15271527
"└ Bedrock region: us-west-2",
15281528
"└ Model id: m1",
15291529
"└ For more information see "
1530-
"https://strandsagents.com/latest/user-guide/concepts/model-providers/amazon-bedrock/#on-demand-throughput-isnt-supported",
1530+
"https://strandsagents.com/docs/user-guide/concepts/model-providers/amazon-bedrock/#on-demand-throughput-isnt-supported",
15311531
]
15321532

15331533

0 commit comments

Comments
 (0)