langflow
langflow copied to clipboard
Conditional Flow
Is it possible to create a block that determines which flow to execute based on conditions? For example, execute different flows based on the user's intent.
It seems similar to the contents of this proposal: https://github.com/langflow-ai/langflow/issues/1731
It would be better to implement the function for an LLM to judge and select prompts directly using Langchain's prompt routing. Here is the relevant documentation: https://python.langchain.com/docs/expression_language/how_to/routing/
Implementing prompt routing directly within Langflow could enhance the block coding environment. However, due to the difficulty of fine-tuning, it might be better to utilize Langchain's techniques.
It seems similar to the contents of this proposal: #1731
It would be better to implement the function for an LLM to judge and select prompts directly using Langchain's prompt routing. Here is the relevant documentation: https://python.langchain.com/docs/expression_language/how_to/routing/
Implementing prompt routing directly within Langflow could enhance the block coding environment. However, due to the difficulty of fine-tuning, it might be better to utilize Langchain's techniques.
Thank you for your response. Is it possible to perform different actions based on various LLM outputs with native langflow? For example, call vector db
if the LLM output is vector db
and call calendar
if the LLM output is calendar
. It would be fantastic if there were a way to explicitly execute a specific sequence of actions based on user inputs, like following a decision tree path. This would be especially helpful in scenarios where the action/decision tree is extensive and complex.
In my opinion, such a division could be adequately replaced by using Langflow's Flow as Tool component.
Hey all
We have added a feature in the CustomComponent that can fulfill that role even if not ideal yet.
Disclaimer: This is still experimental
The CustomComponent now has a stop
method. We have added the TextOperator
component that allows you to make a certain branch of your flow stop on its tracks.
The general gist of it is you'll create two branches in your flow one for each class and define the rest of the process for each one. The TextOperator (or whatever other component you define that calls stop
) will test the condition and stop or let the flow run.
Hey all
We have added a feature in the CustomComponent that can fulfill that role even if not ideal yet.
Disclaimer: This is still experimental
The CustomComponent now has a
stop
method. We have added theTextOperator
component that allows you to make a certain branch of your flow stop on its tracks.The general gist of it is you'll create two branches in your flow one for each class and define the rest of the process for each one. The TextOperator (or whatever other component you define that calls
stop
) will test the condition and stop or let the flow run.
Wow this is great! I will try it out.
Implementing prompt routing directly within Langflow could enhance the block coding environment. However, due to the difficulty of fine-tuning, it might be better to utilize Langchain's techniques.
Consider that there may be sophisticated but non-dev users of the platform who neither know of or care about LangChain. Specifically, in our product we want to offer a constrained version of LangFlow (with curated and custom task-specific components) to minimize cognitive load.
For instance in a call center environment, the user may want to construct a dialog-tree like flow depending on Entity Recognition (did the agent mention a competitor ?), Sentiment Analysis (does the client think we suck ?).
There should be a component specialized to this scenario (choice among options) . LangFlow, stripped to its basics is really a workflow execution engine, and a branching node would seem fundamental.
Prior art: https://rivet.ironcladapp.com/docs/node-reference/if-else
Hello there,
This feature is now available in the current version. Please try updating to the latest version.
@anovazzi which component is it called exactly? I went through all of them and couldn't find it
Hey @Alex-Poon,
There is a conditional router component, but you can also adapt any component you have. Now that you can create components with multiple outputs, you can set up conditional paths with them.
Hi, I am using the conditional router. I want to pass a message for only one of the flows. Is that possible? The next components are Prompt templates, the input is empty on the input message, but it does not prevent the flow to run
Hi @httplups, I've had the same problem. Do you have a solution?
@MarceloNunesAlves I did not :(