Skip to content

Commit 189dce5

Browse files
dsfacciniDouweM
andauthored
Apply suggestions from code review
Co-authored-by: Douwe Maan <[email protected]>
1 parent 5d15e4b commit 189dce5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/output.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ RouterFailure(explanation='I am not equipped to provide travel information, such
237237

238238
#### Text output
239239

240-
If you provide an output function that takes a string, Pydantic AI will by default create an output tool like for any other output function. If instead you'd like the model to provide the string using plain text output, you can wrap the function in the [`TextOutput`][pydantic_ai.output.TextOutput] marker class. If desired, this marker class can be used alongside one or more [`ToolOutput`](#tool-output) marker classes (or unmarked types or functions) in a list provided to `output_type`.
240+
If you provide an output function that takes a string, Pydantic AI will by default create an output tool like for any other output function. If instead you'd like the model to provide the string using plain text output, you can wrap the function in the [`TextOutput`][pydantic_ai.output.TextOutput] marker class.
241+
242+
If desired, this marker class can be used alongside one or more [`ToolOutput`](#tool-output) marker classes (or unmarked types or functions) in a list provided to `output_type`.
243+
244+
Like other output functions, text output functions can optionally take [`RunContext`][pydantic_ai.tools.RunContext] as the first argument, and can raise [`ModelRetry`][pydantic_ai.exceptions.ModelRetry] to ask the model to try again with modified arguments (or with a different output type).
241245

242246
```python {title="text_output_function.py"}
243247
from pydantic_ai import Agent, TextOutput

0 commit comments

Comments
 (0)