Can we add an optional feature to LLM nodes that only executes when a certain condition is met, otherwise it returns the default value #7230

Closed
opened 2026-02-21 18:19:33 -05:00 by yindo · 3 comments
Owner

Originally created by @yg2024 on GitHub (Dec 16, 2024).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Can we add an optional feature to LLM nodes that only executes when a certain condition is met, otherwise it returns the default value

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @yg2024 on GitHub (Dec 16, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Can we add an optional feature to LLM nodes that only executes when a certain condition is met, otherwise it returns the default value ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:19:33 -05:00
yindo closed this issue 2026-02-21 18:19:33 -05:00
Author
Owner

@crazywoola commented on GitHub (Dec 16, 2024):

Can you share the use case and describe why you need this? I don't see the differences by add a if/else before the llm node, and it is more flexible. By add this duplicated feature into llm self seems unnecessary to me.

@crazywoola commented on GitHub (Dec 16, 2024): Can you share the use case and describe why you need this? I don't see the differences by add a if/else before the llm node, and it is more flexible. By add this duplicated feature into llm self seems unnecessary to me.
Author
Owner

@yg2024 commented on GitHub (Dec 17, 2024):

image
In this situation, the node executing SQL needs to use the SQL generated earlier. Although this can be solved by adding session variables, session variables will cause the final reply stage to only reply in full at once, and there is no way to respond in a streaming manner

@yg2024 commented on GitHub (Dec 17, 2024): ![image](https://github.com/user-attachments/assets/99fd46b1-ac1c-4c67-ad3f-c4c4c04f5660) In this situation, the node executing SQL needs to use the SQL generated earlier. Although this can be solved by adding session variables, session variables will cause the final reply stage to only reply in full at once, and there is no way to respond in a streaming manner
Author
Owner

@dosubot[bot] commented on GitHub (Jan 21, 2025):

Hi, @yg2024. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You requested a feature for LLM nodes to execute conditionally, returning a default value otherwise.
  • Crazywoola suggested using an if/else condition for flexibility.
  • You provided a use case involving SQL execution, noting that session variables could work but limit streaming responses.

Next Steps:

  • Please let us know if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 21, 2025): Hi, @yg2024. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You requested a feature for LLM nodes to execute conditionally, returning a default value otherwise. - Crazywoola suggested using an if/else condition for flexibility. - You provided a use case involving SQL execution, noting that session variables could work but limit streaming responses. **Next Steps:** - Please let us know if this issue is still relevant to the latest version of the Dify repository by commenting here. - If there is no further activity, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7230