promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[Feature Request] Optimization for conditional control.

Open kachely opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. Hi team,

I found prompt flow is really convenient for debugging, especially for turning the prompts. But I feel the if/else is not very easy to be implemented in prompt flow. I have followed the wiki to create a conditional control. https://microsoft.github.io/promptflow/how-to-guides/add-conditional-control-to-a-flow.html The flow is as follow. image This is not my expected flow. I would like the node D not to be triggered when node C is not executed.

Describe the solution you'd like Is it possible to not to trigger the node if any of the input is not executed.

Describe alternatives you've considered Or is it possible to add custom filter here like (!=, is null) thus I can use it to check whether to run node D. Since the output will be empty if node C is not executed. image For now, I need to check node B's result for all nodes which used the result of node A.

Additional context Please let me know if you have any other suggestions for my scenario. Thank you!

kachely avatar Nov 28 '23 11:11 kachely

Hi @kachely Thanks your feedback and suggestions.

Not sure if you've awared that, when a node is bypassed, its output is set to None. And a downstream node will only be skipped if all its references are not executed. Coincidentally, this node D also references another node A, therefore, in your graph, node D runs whenever node C is bypassed

I noticed you have the workaround to check your node B output for all nodes. And the alternatives you've considered is great! Feedback take! I'm sorry for the difficulties you're facing. But at present we don't have a clear design for this part yet. We will update this issue as soon as we make progress. However, we welcome and appreciate your contributions, feel free to share design ideas with us.

jiaochenlu avatar Nov 29 '23 03:11 jiaochenlu

Thank you for the quick response! @jiaochenlu Also if you can add another option like is not in activate config will be good. Then I just need to check if the node is executed with string is not null to make the flow more concise.

image

kachely avatar Nov 29 '23 06:11 kachely

While this is still opened, it would be nice if array is also added as an allowed type.

fbinotto avatar Jun 12 '24 08:06 fbinotto

@fbinotto we have the new “Flex flow" released. This feature enables developers to craft LLM apps using a python function or class as the entry point, encapsulating all their app logic. And it also provides a more seamless code experience, allowing for further batch testing, tracing and evaluating of the applications in prompt flow.

Moreover, the Flex flow enhances flexibility in conditional judgments by enabling the use of python functions for definition. We believe this approach will be both familiar and favored by many developers.

get start with flex flow

jiaochenlu avatar Jun 13 '24 03:06 jiaochenlu