The LLM Node change my input {variable} unexpectly #4217

Closed
opened 2026-02-21 18:05:15 -05:00 by yindo · 9 comments
Owner

Originally created by @forrestsocool on GitHub (Jun 21, 2024).

Originally assigned to: @takatost on GitHub.

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).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.11

Cloud or Self Hosted

Cloud

Steps to reproduce

when there are some special text in the {variable} ,the LLM node will change id unexpectly during the data processing.
the sepcial text is like "<id:123123>" it is useful when we need to append some additional information.

✔️ Expected Behavior

don't change the {variable}

Actual Behavior

the sepcial text is like "<id:123123>" is deleted unexpectly

Originally created by @forrestsocool on GitHub (Jun 21, 2024). Originally assigned to: @takatost on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.11 ### Cloud or Self Hosted Cloud ### Steps to reproduce when there are some special text in the {variable} ,the LLM node will change id unexpectly during the data processing. the sepcial text is like "\<id:123123\>" it is useful when we need to append some additional information. ### ✔️ Expected Behavior don't change the {variable} ### ❌ Actual Behavior the sepcial text is like "\<id:123123\>" is deleted unexpectly
yindo added the 🐞 bug label 2026-02-21 18:05:15 -05:00
yindo closed this issue 2026-02-21 18:05:15 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 21, 2024):

Hello @forrestsocool! I'm here to assist you with bug-solving, answering questions, and contributing while you wait for a human maintainer.

The LLM Node in Dify version 0.6.11 might change or delete special text like "id:123123" due to how it handles special variables and context variables in the prompt. To prevent this, you can use the Jinja-2 template language supported by the LLM's prompt editor to escape or handle special characters properly. For example:

{% raw %}
<id:123123>
{% endraw %}

Using {% raw %} and {% endraw %} tags in Jinja-2 will ensure that the special text is treated as literal text and not processed or altered by the system [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 21, 2024): <!-- Greeting --> Hello @forrestsocool! I'm here to assist you with bug-solving, answering questions, and contributing while you wait for a human maintainer. <!-- Answer --> The LLM Node in Dify version 0.6.11 might change or delete special text like "<id:123123>" due to how it handles special variables and context variables in the prompt. To prevent this, you can use the Jinja-2 template language supported by the LLM's prompt editor to escape or handle special characters properly. For example: ```jinja {% raw %} <id:123123> {% endraw %} ``` Using `{% raw %}` and `{% endraw %}` tags in Jinja-2 will ensure that the special text is treated as literal text and not processed or altered by the system <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/workflow/node/llm.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@iamjoel commented on GitHub (Jul 2, 2024):

I can't find the way to create a variable which includes special text like id:123123. Can you tell me way to create it? @forrestsocool

@iamjoel commented on GitHub (Jul 2, 2024): I can't find the way to create a variable which includes special text like <id:123123>. Can you tell me way to create it? @forrestsocool
Author
Owner

@forrestsocool commented on GitHub (Jul 5, 2024):

I can't find the way to create a variable which includes special text like id:123123. Can you tell me way to create it? @forrestsocool

there are several ways In my case, the variable is generated by a upstream LLM node, which is used to distinguish from normal character and used by the downstream LLM/code node. For convenient, you can use the test ui of any node, and just input what u want directly.

@forrestsocool commented on GitHub (Jul 5, 2024): > I can't find the way to create a variable which includes special text like id:123123. Can you tell me way to create it? @forrestsocool there are several ways In my case, the variable is generated by a upstream LLM node, which is used to distinguish from normal character and used by the downstream LLM/code node. For convenient, you can use the test ui of any node, and just input what u want directly.
Author
Owner

@forrestsocool commented on GitHub (Jul 5, 2024):

@iamjoel

@forrestsocool commented on GitHub (Jul 5, 2024): @iamjoel
Author
Owner

@iamjoel commented on GitHub (Jul 7, 2024):

I can't find the way to create a variable which includes special text like id:123123. Can you tell me way to create it? @forrestsocool

there are several ways In my case, the variable is generated by a upstream LLM node, which is used to distinguish from normal character and used by the downstream LLM/code node. For convenient, you can use the test ui of any node, and just input what u want directly.

@forrestsocool Can you provide a App DSL?

@iamjoel commented on GitHub (Jul 7, 2024): > > I can't find the way to create a variable which includes special text like id:123123. Can you tell me way to create it? @forrestsocool > > there are several ways In my case, the variable is generated by a upstream LLM node, which is used to distinguish from normal character and used by the downstream LLM/code node. For convenient, you can use the test ui of any node, and just input what u want directly. @forrestsocool Can you provide a App DSL?
Author
Owner

@forrestsocool commented on GitHub (Jul 9, 2024):

DSL yml:
test (1).zip

To Use:
1.click run
2.input variable as described in the pic
3.check result

intput:
image

output:
image

@iamjoel

@forrestsocool commented on GitHub (Jul 9, 2024): DSL yml: [test (1).zip](https://github.com/user-attachments/files/16154375/test.1.zip) To Use: 1.click run 2.input variable as described in the pic 3.check result **intput:** ![image](https://github.com/langgenius/dify/assets/3960433/fab64c4a-4e15-4524-8b28-b6765e2e1442) **output:** ![image](https://github.com/langgenius/dify/assets/3960433/a1504817-3221-4c17-9045-4aa4e45c7aa6) @iamjoel
Author
Owner

@forrestsocool commented on GitHub (Jul 12, 2024):

@iamjoel Anything progress?

@forrestsocool commented on GitHub (Jul 12, 2024): @iamjoel Anything progress?
Author
Owner

@bslml commented on GitHub (Jul 14, 2024):

same issue

@bslml commented on GitHub (Jul 14, 2024): same issue
Author
Owner

@iamjoel commented on GitHub (Jul 14, 2024):

@takatost some variable value includes special letters would be ignored in prompt.

Prompt:
image

Result:
image
image

@iamjoel commented on GitHub (Jul 14, 2024): @takatost some variable value includes special letters would be ignored in prompt. **Prompt:** <img width="395" alt="image" src="https://github.com/user-attachments/assets/36027d6f-dff3-4862-bc87-a83ef42443de"> **Result:** <img width="403" alt="image" src="https://github.com/user-attachments/assets/f565f254-53f8-4d3f-a92d-f8354a789069"> <img width="408" alt="image" src="https://github.com/user-attachments/assets/56b1f918-fe61-421d-a9ab-272f1fa3018f">
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4217