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

fix: Optimize Setting of Output Required Inputs #4389

Merged
merged 5 commits into from
Nov 5, 2024

Conversation

edwinjosechittilappilly
Copy link
Collaborator

@edwinjosechittilappilly edwinjosechittilappilly commented Nov 4, 2024

Description:

This update modifies the logic for setting required inputs for outputs in the Component class. Previously, the code would set required inputs even if they were already defined. With this change, the required inputs are only set if they are not already specified. This ensures that existing configurations are preserved and only missing required inputs are added.

Changes Made:

  • Added a conditional check to skip setting required inputs if they are already defined.

Rationale:

This change improves the efficiency of the component setup process by avoiding redundant operations. It ensures that the required inputs are only set when necessary, which can help prevent potential overwrites of existing configurations.

Impact:

This change should not affect existing functionality but will optimize the setup process for components with pre-defined required inputs.


AutoGenerated

This pull request includes a small change to the _set_output_return_type method in the src/backend/base/langflow/custom/custom_component/component.py file. The change adds a condition to continue the loop if the output has required_inputs.

Fix required inputs not updated if its already defined
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 4, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 4, 2024
Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 5, 2024
Fix required inputs not updated if its already defined
@edwinjosechittilappilly
Copy link
Collaborator Author

Screenshot 2024-11-04 at 11 22 16 PM

Copy link

codspeed-hq bot commented Nov 5, 2024

CodSpeed Performance Report

Merging #4389 will improve performances by 60.32%

Comparing fix-agent-as-tools (978fb69) with main (b6e8d41)

Summary

⚡ 5 improvements
✅ 11 untouched benchmarks

Benchmarks breakdown

Benchmark main fix-agent-as-tools Change
test_load_flows 1,426.6 µs 889.8 µs +60.32%
test_invalid_run_with_input_type_chat 17.7 ms 15.2 ms +16.58%
test_starter_projects 1,130.2 ms 993.4 ms +13.77%
test_successful_run_with_input_type_text 528.3 ms 451.4 ms +17.05%
test_successful_run_with_output_type_debug 572.6 ms 452.7 ms +26.48%

@edwinjosechittilappilly
Copy link
Collaborator Author

Screenshot 2024-11-04 at 11 32 06 PM Pytest passes. But still in CI it says it failed. Running again.

Added pytest : Splitter single test to multiple components.

Explicitly added outputs to open ai component.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Nov 5, 2024
@ogabrielluiz ogabrielluiz merged commit 7cc497a into main Nov 5, 2024
27 of 35 checks passed
@ogabrielluiz ogabrielluiz deleted the fix-agent-as-tools branch November 5, 2024 05:31
ogabrielluiz added a commit that referenced this pull request Nov 5, 2024
ogabrielluiz added a commit that referenced this pull request Nov 5, 2024
ogabrielluiz added a commit that referenced this pull request Nov 5, 2024
Revert "fix: Optimize Setting of Output Required Inputs (#4389)"

This reverts commit 7cc497a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants