-
Notifications
You must be signed in to change notification settings - Fork 96
Add usage guidance for structured_output behaviour #261
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
base: main
Are you sure you want to change the base?
Conversation
Then use the `Agent.structured_output()` method as shown in the following sections. | ||
|
||
> #### Note on Usage | ||
> Using `structured_ouput` creates a tool with the same name as the Pydantic model you have defined, say - "SomePydanticModel". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only true for some providers - others use the model's API for structured output.
For the providers that do use a tool - the only tool available is the PydanticModel tool and now it's forced used so the model doesn't even have a choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated according to comment.
@zastrowm could you take another look? |
We need @afarntrog 's review to close this as well, I believe. |
Then use the `Agent.structured_output()` method: | ||
Then use the `Agent.structured_output()` method as shown in the following sections. | ||
|
||
> #### Note on Usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using the following format for the note instead:
!!! note "Note on Usage"
text here...
This will render it with a note background and icon like we elsewhere. For example: https://squidfunk.github.io/mkdocs-material/reference/admonitions/#changing-the-title
Description
Added usage guidance on a commonly observed misunderstanding about "structured_output". Customers usually expect to be able to use "structured_output" to continue conversations like regular agent prompts, however tool use apart from the Pydantic model tool cause errors
Type of Change
Motivation and Context
Primarily provides more clarity on the intended usage as called out here -
309, 872
Improves customer expectation for short-term, while changes like strands-agents/sdk-python#891 can potentially solve for long term.
Areas Affected
Description of structured_output
Screenshots
Checklist
mkdocs serve
Additional Notes
None
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.