-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
feat: Enhance StructuredOutputComponent and add trustcall dependency #7249
Open
ogabrielluiz
wants to merge
6
commits into
main
Choose a base branch
from
improve-structured-output-component
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…er for enhanced flexibility in tool binding
…r for structured output and enhance result handling * Replaced direct call to with_structured_output with create_extractor for improved flexibility. * Added handling for "responses" in result to ensure proper data extraction. * Introduced is_last_pydantic_output_parser method to check parser type in structured output processing.
…AI and NVIDIA models * Implemented multiple test cases for StructuredOutputComponent using real OpenAI and NVIDIA models. * Added tests for simple, complex, and nested schemas to validate structured output extraction. * Included error handling tests to ensure proper response to model limitations and API errors. * Utilized pytest for conditional test execution based on environment variables for API keys.
…ponent with enhanced input and output handling * Integrated StructuredOutputComponent into Financial Report Parser and Portfolio Website Code Generator starter projects. * Updated input fields to include detailed descriptions and requirements for structured output generation. * Ensured consistent schema definitions and improved error handling for model limitations. * Enhanced documentation for better clarity on component usage and expected outputs.
@@ -192,3 +197,8 @@ def as_dataframe(self) -> DataFrame: | |||
if isinstance(output, list): | |||
return DataFrame(data=output) | |||
return DataFrame(data=[output]) | |||
|
|||
def is_last_pydantic_output_parser(self, llm_with_structured_output: Runnable) -> bool: | |||
return isinstance(llm_with_structured_output.last, PydanticOutputParser) and not issubclass( |
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.
Why not subclass
? (Specifically, this wouldn't catch the nvidia behavior)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Introduce a new optional parameter for tool binding, improve structured output handling, and integrate comprehensive tests for the StructuredOutputComponent. Update starter projects to utilize the enhanced component and include the trustcall dependency in the project configuration.