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 dynamic outputs to Component #4308

Merged
merged 17 commits into from
Nov 4, 2024

Conversation

ogabrielluiz
Copy link
Contributor

@ogabrielluiz ogabrielluiz commented Oct 28, 2024

This pull request includes several changes to improve the backend and frontend functionality of the Langflow project. The most important changes include updates to the custom component handling, validation improvements, and modifications to the frontend data fetching and mutation logic.

Backend Improvements:

Frontend Improvements:

@github-actions github-actions bot added the enhancement New feature or request label Oct 28, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 28, 2024
@ogabrielluiz ogabrielluiz force-pushed the feat-add-dynamic-output-and-tool-output- branch from fe3154a to 7b342f4 Compare October 28, 2024 20:06
@ogabrielluiz ogabrielluiz marked this pull request as ready for review October 28, 2024 20:07
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 28, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 28, 2024
@ogabrielluiz ogabrielluiz force-pushed the feat-add-dynamic-output-and-tool-output- branch from fe09438 to ac759a2 Compare October 29, 2024 20:06
This commit refactors the Component class in the `component.py` file. It introduces two new methods: `update_inputs` and `run_and_validate_update_outputs`. The `update_inputs` method allows for updating the build configuration with new field values, while the `run_and_validate_update_outputs` method updates the frontend node and validates the outputs. Additionally, the `_validate_frontend_node` method is added to check if all outputs are valid. The `_set_output_types` method is modified to accept a list of outputs and set their return types. Overall, these changes improve the functionality and maintainability of the Component class.
@ogabrielluiz ogabrielluiz force-pushed the feat-add-dynamic-output-and-tool-output- branch from ac759a2 to ab42efb Compare October 30, 2024 11:19
@edwinjosechittilappilly
Copy link
Collaborator

Earlier frontend_node was used to update the inputs and later we moved to build_config.

In the same way, should we utilize build_config instead of frontend_node so the DX would be much better?
What do you suggest @ogabrielluiz

@ogabrielluiz
Copy link
Contributor Author

Earlier frontend_node was used to update the inputs and later we moved to build_config.

In the same way, should we utilize build_config instead of frontend_node so the DX would be much better? What do you suggest @ogabrielluiz

They serve different purposes. We could put them in a single method but I think that would make it confusing

Copy link
Collaborator

@edwinjosechittilappilly edwinjosechittilappilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Good Work. May be we can improve the experience later. But this is going to be awesome start.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 1, 2024
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) November 3, 2024 13:18
@ogabrielluiz ogabrielluiz merged commit 42cc1da into main Nov 4, 2024
28 of 29 checks passed
@ogabrielluiz ogabrielluiz deleted the feat-add-dynamic-output-and-tool-output- branch November 4, 2024 12:31
ogabrielluiz added a commit that referenced this pull request Nov 4, 2024
* Refine condition to check for undefined value in use-handle-new-value hook

* update mutateTemplate to use APIClassType

* Refactor Component class to update inputs and validate outputs

This commit refactors the Component class in the `component.py` file. It introduces two new methods: `update_inputs` and `run_and_validate_update_outputs`. The `update_inputs` method allows for updating the build configuration with new field values, while the `run_and_validate_update_outputs` method updates the frontend node and validates the outputs. Additionally, the `_validate_frontend_node` method is added to check if all outputs are valid. The `_set_output_types` method is modified to accept a list of outputs and set their return types. Overall, these changes improve the functionality and maintainability of the Component class.

* Add dynamic output validation in API endpoint for component updates

* Update build_config to store field_value under "value" key

* Refactor: Convert dict values to list in _set_output_types call

* Add type check for `cc_instance` before calling `run_and_validate_update_outputs`

* Add DynamicOutputComponent with configurable outputs based on input

* Add test for updating component outputs with dynamic code input

* Refactor: Make get_dynamic_output_component_code asynchronous for improved performance

---------

Co-authored-by: Edwin Jose <[email protected]>
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:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants