Skip to content

Correct error message for invalid output types with strict JSON schema #1101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
4 changes: 2 additions & 2 deletions src/agents/agent_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def __init__(self, output_type: type[Any], strict_json_schema: bool = True):
except UserError as e:
raise UserError(
"Strict JSON schema is enabled, but the output type is not valid. "
"Either make the output type strict, or pass output_schema_strict=False to "
"your Agent()"
"Either make the output type strict, "
"or wrap your type with AgentOutputSchema(your_type, strict_json_schema=False)"
) from e

def is_plain_text(self) -> bool:
Expand Down