Skip to content

Commit 99ba260

Browse files
Correct error message for invalid output types with strict JSON schema (#1101)
### Problem 1. **Incorrect parameter reference**: Suggests passing `output_schema_strict=False` to `Agent()`, but this parameter doesn't exist 2. **Vague guidance**: The phrase "make the output type strict" doesn't explain HOW to make types strict ### Solution Updated the error message to provide accurate, actionable guidance: **Before:** ``` "Either make the output type strict, or pass output_schema_strict=False to your Agent()" ``` **After:** ``` "Either use a dataclass, Pydantic model, or TypedDict, or wrap your type with AgentOutputSchema(your_type, strict_json_schema=False)" ``` --------- Co-authored-by: Kazuhiro Sera <[email protected]>
1 parent 66e5be3 commit 99ba260

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/agents/agent_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ def __init__(self, output_type: type[Any], strict_json_schema: bool = True):
115115
except UserError as e:
116116
raise UserError(
117117
"Strict JSON schema is enabled, but the output type is not valid. "
118-
"Either make the output type strict, or pass output_schema_strict=False to "
119-
"your Agent()"
118+
"Either make the output type strict, "
119+
"or wrap your type with AgentOutputSchema(your_type, strict_json_schema=False)"
120120
) from e
121121

122122
def is_plain_text(self) -> bool:

0 commit comments

Comments
 (0)