langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
38.2k stars 5.21k forks source link

for/while loop in workflow #4317

Closed YingchaoX closed 1 month ago

YingchaoX commented 2 months ago

Self Checks

1. Is this request related to a challenge you're experiencing?

now i need to repeat the llm node again and again

2. Describe the feature you'd like to see

for loop or while loop in workflow

3. How will this feature improve your workflow or experience?

i don't know to repeat the llm node again and again

4. Additional context or comments

No response

5. Can you help us with this feature?

mkaskov commented 1 month ago

as I understood Duplicated https://github.com/langgenius/dify/issues/3634 but what is the status and deadline?

VincePotato commented 1 month ago

Hi,We're designing a new node in the dify workflow called "iteration." Its purpose is to perform multiple steps on a list object until all results are outputted.

You can use this node for generating long texts, like first having an LLM create a story outline based on a user-inputted theme, then feeding the outline list into the Iteration and LLM nodes for multiple iterations until a complete story is generated.

The Iteration node allows the AI workflow to handle more complex processing logic. This feature is coming soon in our recent version.

VincePotato commented 1 month ago

The while loop node will be supported later, probably in June.

TianzeWang commented 2 weeks ago

Hi Vince @VincePotato

I am wondering will Dify support the while loop with unknown array length?

I have a scenario that, I want to have multiple round of conversation with LLM and finally rate the conversations with LLM. The # of rounds of conversation is not fixed #. I hope this could be achieved with some logic like:

While (! flag A) { Conversation with LLM; flag A = Decide flag A is entered by user?;} Then {Move to next node}