Open ChunJen opened 1 week ago
The issue you're experiencing with the Conditional Router
component not stopping correctly when using self.stop('method_name')
might be related to how the stop function is implemented and how it interacts with the workflow execution. The stop
function is supposed to halt a specific branch of the workflow by marking it as "INACTIVE" in the graph. However, if subsequent components are still being executed, it suggests that the stop command might not be effectively preventing further execution in the workflow.
Here are a few things you might want to check or try:
Ensure Correct Output Name: Make sure that the output_name
you are passing to self.stop()
matches the actual output name in your workflow. If the name is incorrect, the stop command might not be applied to the intended branch.
Check Workflow Configuration: Verify that the workflow configuration correctly reflects the intended logic and that there are no additional paths or conditions that might lead to the execution of subsequent components.
Debugging: Add logging or print statements before and after the self.stop()
call to ensure that the function is being executed and to check the state of the workflow at that point.
Review Changes Between Versions: Since the issue persists across versions 1.0.17 and 1.1.0, review any changes in the implementation of the Conditional Router
or related components that might affect the stop functionality.
If these steps do not resolve the issue, it might require a deeper investigation into the codebase to understand how the stop command is processed and why it might not be affecting the workflow as expected.
To continue talking to Dosu, mention @dosu.
Following changes will help you.
def true_response(self) -> Message: result = self.evaluate_condition(self.input_text, self.match_text, self.operator, self.case_sensitive) if result: return self.message else: self.stop('true_response') return ""
@irshadmb Hi thanks for respones!
It is kinda a way to make it return nothing with ""
.
However, it is just a simplified flow here, so i still need one solution to make this happend. Because the prompt here, it represented a whole SubFlow.
Is it possible in Langflow?
PR #3904
https://github.com/langflow-ai/langflow/pull/3904
Please review this PR and test the multi-conditional router, see if it fits your scenario.
Let us know if it resolves the issue. If it does, we will consider adding an enhanced version of the multi-conditional router to the components in the upcoming release.
cc. @carlosrcoelho @jordanrfrazier ref: Multiconditional router
Bug Description
I change the conditional Router with
self.stop('method_name')
, but the components of the subsequent process will still be executed. It happened in both of version 1.0.17 and 1.1.0With the workflow:
[python 3.12.3, langflow 1.0.17]
20241114_debug_conditional_router.json 20241114_debug_conditional_router_v2.json
Test Case
1.input=A, expected_output=A, real_output=A None None
2.input=B, expected_output=B, real_output=None B None
[python 3.12.3, langflow 1.1.0]
Still not work in this version: 20241114_debug_conditional_router_v2_使用langflow1.1.0版本.json
Reproduction
Expected behavior
Just like in Bug Description
Who can help?
No response
Operating System
Windows 11
Langflow Version
1.0.17
Python Version
3.12
Screenshot
No response
Flow File
20241114_debug_conditional_router_v2.json 20241114_debug_conditional_router.json 20241114_debug_conditional_router_v2_使用langflow1.1.0版本.json