Skip to content

Commit bdc893b

Browse files
authored
[Feat] Update structured output error message (#563)
* Update bedrock.py * Update anthropic.py
1 parent 3f4c3a3 commit bdc893b

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
@@ -584,7 +584,7 @@ async def structured_output(
584584
stop_reason, messages, _, _ = event["stop"]
585585

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

589589
content = messages["content"]
590590
output_response: dict[str, Any] | None = None

0 commit comments

Comments
 (0)