diff --git a/src/strands/models/anthropic.py b/src/strands/models/anthropic.py index eb72becfd..0d734b762 100644 --- a/src/strands/models/anthropic.py +++ b/src/strands/models/anthropic.py @@ -414,7 +414,7 @@ async def structured_output( stop_reason, messages, _, _ = event["stop"] if stop_reason != "tool_use": - raise ValueError("No valid tool use or tool use input was found in the Anthropic response.") + raise ValueError(f"Model returned stop_reason: {stop_reason} instead of \"tool_use\".") content = messages["content"] output_response: dict[str, Any] | None = None diff --git a/src/strands/models/bedrock.py b/src/strands/models/bedrock.py index 679f1ea3d..cf1e4d3a9 100644 --- a/src/strands/models/bedrock.py +++ b/src/strands/models/bedrock.py @@ -584,7 +584,7 @@ async def structured_output( stop_reason, messages, _, _ = event["stop"] if stop_reason != "tool_use": - raise ValueError("No valid tool use or tool use input was found in the Bedrock response.") + raise ValueError(f"Model returned stop_reason: {stop_reason} instead of \"tool_use\".") content = messages["content"] output_response: dict[str, Any] | None = None