feat: support structured output for agents#192
Open
crazybolillo wants to merge 1 commit intocharmbracelet:mainfrom
Open
feat: support structured output for agents#192crazybolillo wants to merge 1 commit intocharmbracelet:mainfrom
crazybolillo wants to merge 1 commit intocharmbracelet:mainfrom
Conversation
dfd8e00 to
b77e637
Compare
Author
|
I opened this to solve #118. I did not create a discussion for this feature but this can be a good conversation starter 😄. I can make changes as maintainers see fit to adapt this into the existing project plans. Will hold-off on adding unit tests till then. |
b77e637 to
f4a5e15
Compare
f4a5e15 to
2972b6f
Compare
To enable this, LanguageModel required updates to support tool calls as normal, non structured generation methods already do. These changes are fully backwards compatible. Note that for this feature to work, each provider must explicitly support tool calls alongside structured output. This commit only implements it for the OpenAI provider. If a provider lacks support, the agent will only generate structured output without executing tool calls. Closes charmbracelet#118.
2972b6f to
84a30ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To enable this, LanguageModel required updates to support tool calls as normal, non structured generation methods already do.
These changes are fully backwards compatible. Note that for this feature to work, each provider must explicitly support tool calls alongside structured output. This commit only implements it for the OpenAI provider.
If a provider lacks support, the agent will only generate structured output without executing tool calls.
CONTRIBUTING.md.