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: add a check in ComponentToolkit to avoid building a tool that builds tools #4678

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

ogabrielluiz
Copy link
Contributor

@ogabrielluiz ogabrielluiz commented Nov 18, 2024

This pull request includes changes to the src/backend/base/langflow/base/tools/component_tool.py file to enhance the tool type handling in the get_tools function. The main changes involve the introduction of a new set of tool types and the modification of the tool filtering logic.

Enhancements to tool type handling:

  • Added a new set TOOL_TYPES_SET containing the tool types {"Tool", "BaseTool", "StructuredTool"}.
  • Modified the get_tools function to skip outputs whose types match any in the TOOL_TYPES_SET, in addition to the existing condition on TOOL_OUTPUT_NAME.
  • Remove tool_mode from CalculatorToolComponent

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Nov 18, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 18, 2024
@ogabrielluiz ogabrielluiz force-pushed the fix-tool-build-tool-output branch from e5d17f1 to 99d89ba Compare November 18, 2024 16:21
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) November 18, 2024 16:21
Copy link

codspeed-hq bot commented Nov 18, 2024

CodSpeed Performance Report

Merging #4678 will degrade performances by 52.92%

Comparing fix-tool-build-tool-output (af35c37) with main (699ec18)

Summary

⚡ 1 improvements
❌ 3 regressions
✅ 11 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main fix-tool-build-tool-output Change
test_successful_run_with_input_type_any 298.5 ms 220 ms +35.65%
test_successful_run_with_input_type_text 217.5 ms 296.5 ms -26.65%
test_successful_run_with_output_type_any 232.6 ms 391.3 ms -40.57%
test_successful_run_with_output_type_debug 139.1 ms 295.4 ms -52.92%

@edwinjosechittilappilly
Copy link
Collaborator

Earlier, we added Tool mode True to the calculator. We can remove it in this PR If so.

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.

We might need to improve. The Tool creation , build_tool etc and make it consistent with the component toolkit later.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 18, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 18, 2024
@ogabrielluiz ogabrielluiz force-pushed the fix-tool-build-tool-output branch from ff9dfb0 to fd1ff9b Compare November 18, 2024 21:18
@ogabrielluiz ogabrielluiz force-pushed the fix-tool-build-tool-output branch from fd1ff9b to af35c37 Compare November 19, 2024 13:29
@ogabrielluiz ogabrielluiz merged commit 50defed into main Nov 19, 2024
29 checks passed
@ogabrielluiz ogabrielluiz deleted the fix-tool-build-tool-output branch November 19, 2024 13:54
diogocabral pushed a commit to headlinevc/langflow that referenced this pull request Nov 26, 2024
…ilds tools (langflow-ai#4678)

* Enhance tool filtering logic by adding TOOL_TYPES set for output type checking

* Rename TOOL_TYPES to TOOL_TYPES_SET for clarity
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:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants