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

IF ELSE can cause the Stream output of LLM nodes to fail. #12068

Closed
5 tasks done
Hisir0909 opened this issue Dec 25, 2024 · 15 comments
Closed
5 tasks done

IF ELSE can cause the Stream output of LLM nodes to fail. #12068

Hisir0909 opened this issue Dec 25, 2024 · 15 comments

Comments

@Hisir0909
Copy link
Contributor

Hisir0909 commented Dec 25, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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.

Dify version

0.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

MyDSL
app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: test bug - 2
  use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 100
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1732074063800-source-1735117839833-target
      source: '1732074063800'
      sourceHandle: source
      target: '1735117839833'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1735117839833-false-1735117849369-target
      source: '1735117839833'
      sourceHandle: 'false'
      target: '1735117849369'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: llm
      id: 1735117839833-true-1735117865507-target
      source: '1735117839833'
      sourceHandle: 'true'
      target: '1735117865507'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: template-transform
        targetType: llm
      id: 1735117849369-source-1735117865507-target
      source: '1735117849369'
      sourceHandle: source
      target: '1735117865507'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: llm
        targetType: end
      id: 1735117865507-source-1735117893818-target
      source: '1735117865507'
      sourceHandle: source
      target: '1735117893818'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: 'no'
          max_length: 48
          options: []
          required: false
          type: text-input
          variable: 'no'
      height: 90
      id: '1732074063800'
      position:
        x: -238.62769206536882
        y: 2.993474134493738
      positionAbsolute:
        x: -238.62769206536882
        y: 2.993474134493738
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: 7be3a434-2c39-4624-89d5-3d43457f36f4
            value: '1'
            varType: string
            variable_selector:
            - '1732074063800'
            - 'no'
          id: 'true'
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 126
      id: '1735117839833'
      position:
        x: -238.62769206536882
        y: 115.96771110887573
      positionAbsolute:
        x: -238.62769206536882
        y: 115.96771110887573
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        selected: false
        template: '111'
        title: 模板转换
        type: template-transform
        variables: []
      height: 54
      id: '1735117849369'
      position:
        x: -48.90588360673496
        y: 273.43506428265556
      positionAbsolute:
        x: -48.90588360673496
        y: 273.43506428265556
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        model:
          completion_params:
            temperature: 0.7
          mode: chat
          name: yi-lightning
          provider: yi
        prompt_template:
        - id: d6c7a9f6-f4d9-4bbf-ac19-6729a6e5b5a7
          role: system
          text: 翻译用户输入 从中文到英文
        - id: 5600c75b-4896-4f1b-94cf-cad5c053de39
          role: user
          text: '苹果iPhone 17 Pro屏幕渲染图曝光:灵动岛或缩小


            目前已有多方消息源确认,苹果将在iPhone 17 Pro系列上使用Metalens技术缩小Face ID模组,从而减小灵动岛的开孔。爆料者根据信息制作了iPhone
            17 Pro的屏幕渲染图,其灵动岛面积相较目前的iPhone 16 Pro系列要小很多。这也是iPhone 14 Pro用上灵动岛后,首次对正面做出较大的改变。


            来源:格隆汇'
        selected: false
        title: LLM
        type: llm
        variables: []
        vision:
          enabled: false
      height: 98
      id: '1735117865507'
      position:
        x: 198.78731092044814
        y: 115.96771110887573
      positionAbsolute:
        x: 198.78731092044814
        y: 115.96771110887573
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1735117865507'
          - text
          variable: text
        selected: false
        title: 结束
        type: end
      height: 90
      id: '1735117893818'
      position:
        x: 474.89243759344015
        y: 115.96771110887573
      positionAbsolute:
        x: 474.89243759344015
        y: 115.96771110887573
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: 454.04147830596025
      y: 252.08975294716515
      zoom: 0.716977624007919

✔️ Expected Behavior

Stream output

❌ Actual Behavior

Stream failed

Copy link

dosubot bot commented Dec 25, 2024

The issue you're experiencing with the stream output failure in LLM nodes when using a variable aggregator might be related to the requirement that the variable aggregator can only aggregate variables of the same data type. If the first variable added to the aggregator is of a certain type, all subsequent variables must match this type. This restriction could lead to issues if there is a mismatch in data types among the variables being aggregated [1].

To troubleshoot this, ensure that all variables being aggregated are of the same data type. If the problem persists, check for any specific error messages or logs that might provide more insight into the failure. Additionally, verify that the variable aggregator is correctly configured to handle the data types involved in your workflow.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@SingleKey
Copy link

After I removed the variable aggregator, the output is still blocking rather than streaming. Could you please guide me on how to modify the yml file to resolve this issue?

@yihong0618
Copy link
Contributor

can you share your dsl?
thanks

@Hisir0909
Copy link
Contributor Author

can you share your dsl?能否共享您的服务器? thanks  谢谢

in Steps to reproduce

@Hisir0909
Copy link
Contributor Author

After I removed the variable aggregator, the output is still blocking rather than streaming. Could you please guide me on how to modify the yml file to resolve this issue?

Oh, it seems the issue is not caused by the variable aggregator, but rather by the IF ELSE statement.

@yihong0618
Copy link
Contributor

it worked in my env
image

@Hisir0909
Copy link
Contributor Author

Hisir0909 commented Dec 25, 2024

it worked in my env image

This is my:

_20241225_165622.webm

@Hisir0909 Hisir0909 changed the title Using a variable aggregator in special cases can cause the Stream output of LLM nodes to fail. IF ELSE can cause the Stream output of LLM nodes to fail. Dec 25, 2024
@yihong0618
Copy link
Contributor

it worked in my env image

This is my: 屏幕录像_20241225_165622.webm

do we have the same dsl it seems different

@lssmlssm
Copy link

Include branch node stream output not working #9852

@Hisir0909
Copy link
Contributor Author

Hisir0909 commented Dec 25, 2024

it worked in my env image

This is my: 屏幕录像_20241225_165622.webm

do we have the same dsl it seems different

The DSL I tested for another person also has the issue that the LLM stream output fails after the IF node.
#9852

@laipz8200
Copy link
Member

it worked in my env image

This is my:
_20241225_165622.webm

If trying to merge several branches into one, you should use the Variable Aggregator Node.

@Hisir0909
Copy link
Contributor Author

Hisir0909 commented Dec 25, 2024

it worked in my env image

This is my:
_20241225_165622.webm

If trying to merge several branches into one, you should use the Variable Aggregator Node.

The problem is the same; it's not caused by not using variable aggregation.

_20241225_180756.mp4

@lssmlssm
Copy link

image
It looks like the old problem from before has resurfaced again...

yihong0618 added a commit to yihong0618/dify that referenced this issue Dec 26, 2024
@yihong0618
Copy link
Contributor

#12105

@yihong0618
Copy link
Contributor

image It looks like the old problem from before has resurfaced again...

fixed

laipz8200 pushed a commit that referenced this issue Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants