Skip to content
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: add StructuredOutput component #4024

Merged
merged 34 commits into from
Oct 15, 2024
Merged

feat: add StructuredOutput component #4024

merged 34 commits into from
Oct 15, 2024

Conversation

ogabrielluiz
Copy link
Contributor

  • Refactor OpenAIModelComponent to use TableInput for output_schema and integrate build_model_from_schema.
  • Modify HierarchicalCrewComponent to use unpacking for base inputs.
  • Ensure consistent import statements across JSON files.
  • Improve error handling and logging for vector store operations.

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4024.dmtpw4p5recq1.amplifyapp.com

@EDLLT
Copy link
Contributor

EDLLT commented Oct 5, 2024

  • Refactor OpenAIModelComponent to use TableInput for output_schema and integrate build_model_from_schema.
  • Modify HierarchicalCrewComponent to use unpacking for base inputs.
  • Ensure consistent import statements across JSON files.
  • Improve error handling and logging for vector store operations.

I'm assuming this also applies to this PR
#4021

@ogabrielluiz
Copy link
Contributor Author

It could but I'm considering something different. I'll push it as soon as I can. I'm considering building a component that builds the structured output using an llm.

@ogabrielluiz ogabrielluiz changed the title Update OpenAI model components feat: add StructuredOutput component Oct 7, 2024
@github-actions github-actions bot added the enhancement New feature or request label Oct 7, 2024
@ogabrielluiz ogabrielluiz marked this pull request as ready for review October 7, 2024 17:33
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Oct 7, 2024
@ogabrielluiz ogabrielluiz marked this pull request as draft October 7, 2024 17:50
@ogabrielluiz ogabrielluiz marked this pull request as ready for review October 7, 2024 17:51
…l.py

- Implement various test cases to validate the functionality of build_model_from_schema.
- Test cases cover scenarios such as handling valid and empty schemas, managing unknown field types, and processing schemas with missing optional keys.
- Ensure proper handling of nested list and dict types, and verify the function's efficiency with large schemas.
- Confirm that the function raises exceptions for invalid input and handles duplicate field names correctly.
- Refactor `OpenAIModelComponent` to use `TableInput` for `output_schema` and integrate `build_model_from_schema`.
- Modify `HierarchicalCrewComponent` to use unpacking for base inputs.
- Ensure consistent import statements across JSON files.
- Improve error handling and logging for vector store operations.
- Implement `build_messages_and_runnable` to construct message lists and configure runnable models.
- Add `get_chat_result` to execute language models with input messages, supporting streaming and custom configurations.
- Handle exceptions with optional custom error messages.
- Implement various test cases to ensure correct functionality of StructuredOutputComponent.
- Test successful structured output generation, handling of unsupported language models, and correct output model building.
- Validate handling of multiple outputs, empty and invalid output schemas, and nested schemas.
- Include tests for large input values and invalid language model configurations.
Rename the test_base_model.py file to test_base_model_from_schema.py to better reflect its purpose of testing the build_model_from_schema function. This change improves code clarity and maintainability.
- Refactored `OpenAIModelComponent` to use `operator.ior` and `functools.reduce` for converting `output_schema` to a dictionary.
- Deprecated the `output_schema` field, updating its info to reflect the deprecation.
- Simplified the `_docs_to_data` method in `SplitTextComponent` for better readability.
- Updated import statements and removed unused imports across multiple JSON files.
@ogabrielluiz ogabrielluiz merged commit 2be7c56 into main Oct 15, 2024
27 checks passed
@ogabrielluiz ogabrielluiz deleted the update-openai branch October 15, 2024 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants