-
Notifications
You must be signed in to change notification settings - Fork 4.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: run flow component with tool mode option to run a flow as a tool #5518
base: main
Are you sure you want to change the base?
Conversation
format
sample component update
tests
solves issues with agents and session ids
update to FlowOrchetstor
…field_template for improved input validation
outputs = [ | ||
Output(display_name="Run Outputs", name="run_outputs", method="generate_results"), | ||
] | ||
async def run_flow_with_tweaks(self) -> list[Data]: |
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.
I think we should have two or three outputs in this component. One for Data, one for DataFrame and possibly one for the first Message. What do you think?
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.
Data and Dataframe sure I could add that.
Can you clarify "" possibly one for the first Message""" Means?
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.
Also, I had assumed that there is only one output function in the tool mode of runflow.
Can I proceed in such a way that the in tool mode the output/method from the data output is utilised, we need not have multiple tools for each outputs right?
for output in run_output.outputs: | ||
if output: | ||
data.extend(build_data_from_result_data(output)) | ||
return Data(data=data[-1].data) |
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.
This can be improved.
This pull request introduces several significant changes across multiple files to enhance the functionality and performance of the Langflow backend. The key changes include converting several synchronous methods to asynchronous, adding new imports, and restructuring the
RunFlowComponent
class.Asynchronous Method Updates:
run_and_validate_update_outputs
method to asynchronous insrc/backend/base/langflow/api/v1/endpoints.py
.to_toolkit
method to asynchronous insrc/backend/base/langflow/base/agents/agent.py
.run_and_validate_update_outputs
and_append_tool_to_outputs_map
methods to asynchronous insrc/backend/base/langflow/custom/custom_component/component.py
. [1] [2]New Imports:
create_input_schema_from_dict
anddotdict
imports insrc/backend/base/langflow/base/tools/component_tool.py
. [1] [2]RunFlowComponent Refactor:
RunFlowComponent
class and replaced it with a new implementation insrc/backend/base/langflow/components/logic/runflow.py
. The new class inherits fromRunFlowBase
and includes methods to handle flow execution with tweaks and updating build configurations. [1] [2]Other Changes:
RunFlowComponent
insrc/backend/base/langflow/components/logic/__init__.py
.run_flow_with_tweaks
to handle running flows with specific tweaks inRunFlowBase
.