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

Conditional Flow #1857

Open
puyuanOT opened this issue May 8, 2024 · 7 comments
Open

Conditional Flow #1857

puyuanOT opened this issue May 8, 2024 · 7 comments
Labels
question Further information is requested

Comments

@puyuanOT
Copy link

puyuanOT commented May 8, 2024

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.

Screenshot 2024-05-07 at 7 31 46 PM
@dosubot dosubot bot added the question Further information is requested label May 8, 2024
@YamonBot
Copy link
Contributor

YamonBot commented May 8, 2024

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.

@puyuanOT
Copy link
Author

puyuanOT commented May 8, 2024

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.

image

@YamonBot
Copy link
Contributor

YamonBot commented May 8, 2024

image

In my opinion, such a division could be adequately replaced by using Langflow's Flow as Tool component.

@ogabrielluiz
Copy link
Contributor

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.

@puyuanOT
Copy link
Author

puyuanOT commented May 8, 2024

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.

Wow this is great! I will try it out.

@ccollie
Copy link

ccollie commented May 23, 2024

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.

@ccollie
Copy link

ccollie commented May 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants