Skip to content

Commit 01691c2

Browse files
Unshuredbschmigelski
authored andcommitted
[Feat] Update structured output error message (strands-agents#563)
* Update bedrock.py * Update anthropic.py
1 parent 4c2d501 commit 01691c2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/strands/models/anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ async def structured_output(
414414
stop_reason, messages, _, _ = event["stop"]
415415

416416
if stop_reason != "tool_use":
417-
raise ValueError("No valid tool use or tool use input was found in the Anthropic response.")
417+
raise ValueError(f"Model returned stop_reason: {stop_reason} instead of \"tool_use\".")
418418

419419
content = messages["content"]
420420
output_response: dict[str, Any] | None = None

src/strands/models/bedrock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ async def structured_output(
588588
stop_reason, messages, _, _ = event["stop"]
589589

590590
if stop_reason != "tool_use":
591-
raise ValueError("No valid tool use or tool use input was found in the Bedrock response.")
591+
raise ValueError(f"Model returned stop_reason: {stop_reason} instead of \"tool_use\".")
592592

593593
content = messages["content"]
594594
output_response: dict[str, Any] | None = None

0 commit comments

Comments
 (0)