Dify : Query or prefix is too long #788

Closed
opened 2026-02-21 17:28:26 -05:00 by yindo · 6 comments
Owner

Originally created by @sjn920336697 on GitHub (Dec 6, 2023).

Originally assigned to: @takatost on GitHub.

Dify version

0.3.32

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Dify framework reports the error : “the query or prefix prompt is too long. You can reduce the prefix prompt, shrink the max token, or switch to a LLM with a larger token limit size.”

The backend model(ChatGLM2) is based on Xinference and deployed locally, the maximum character has been set to 8192 (8K).

I have no problem interacting with Xinference using a Chinese text of more than 2000 characters. However, when I interact with an application built on Dify, it reminds me that the length exceeds the limit, where max_tokens is set to 450.

The same problem also occurs on the OpenLLM framework

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @sjn920336697 on GitHub (Dec 6, 2023). Originally assigned to: @takatost on GitHub. ### Dify version 0.3.32 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Dify framework reports the error : “the query or prefix prompt is too long. You can reduce the prefix prompt, shrink the max token, or switch to a LLM with a larger token limit size.” The backend model(ChatGLM2) is based on Xinference and deployed locally, the maximum character has been set to 8192 (8K). I have no problem interacting with Xinference using a Chinese text of more than 2000 characters. However, when I interact with an application built on Dify, it reminds me that the length exceeds the limit, where max_tokens is set to 450. The same problem also occurs on the OpenLLM framework ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 17:28:26 -05:00
yindo closed this issue 2026-02-21 17:28:26 -05:00
Author
Owner

@gqchen-dz commented on GitHub (Dec 6, 2023):

I meet the same problem.

@gqchen-dz commented on GitHub (Dec 6, 2023): I meet the same problem.
Author
Owner

@crazywoola commented on GitHub (Dec 6, 2023):

image The max token means it's the length of the reply itself. But the `8k = max_token + prefix_prompt`.
@crazywoola commented on GitHub (Dec 6, 2023): <img width="571" alt="image" src="https://github.com/langgenius/dify/assets/100913391/b1f635a2-8571-4659-af57-fdbb8f88458b"> The max token means it's the length of the reply itself. But the `8k = max_token + prefix_prompt`.
Author
Owner

@sjn920336697 commented on GitHub (Dec 7, 2023):

Thx for your reply, but the 8k > max_token(450) + prefix_prompt(about 100) + content(about 2000)
Unfortunately,I reduce max_tokens to 50, it still doesn’t work。

I have no problem interacting with Xinference using a Chinese text of prefix_prompt(about 100) + content(about 3000 >(2000+450)), this made me confuse

@sjn920336697 commented on GitHub (Dec 7, 2023): Thx for your reply, but the `8k > max_token(450) + prefix_prompt(about 100) + content(about 2000)`。 Unfortunately,I reduce max_tokens to 50, it still doesn’t work。 I have no problem interacting with Xinference using a Chinese text of ` prefix_prompt(about 100) + content(about 3000 >(2000+450))`, this made me confuse
Author
Owner

@gqchen-dz commented on GitHub (Dec 7, 2023):

In my scene,the backend model is xinrerence and chatglm3-6b-32k . dify max_tokens sets to 500
It's no problems when interacting with xinference , content length 2164 Chinese characters (include Prefix_prompt+question), but in dify,the same content (include Prefix_prompt+question) , get the error.
Is there any way to adjust this ?

@gqchen-dz commented on GitHub (Dec 7, 2023): In my scene,the backend model is xinrerence and chatglm3-6b-**32k** . dify max_tokens sets to 500 It's no problems when interacting with xinference , content length 2164 Chinese characters (include Prefix_prompt+question), but in dify,the same content (include Prefix_prompt+question) , get the error. Is there any way to adjust this ?
Author
Owner

@sjn920336697 commented on GitHub (Dec 7, 2023):

In my scene,the backend model is xinrerence and chatglm3-6b-32k . dify max_tokens sets to 500 It's no problems when interacting with xinference , content length 2164 Chinese characters (include Prefix_prompt+question), but in dify,the same content (include Prefix_prompt+question) , get the error. Is there any way to adjust this ?

the same problem

@sjn920336697 commented on GitHub (Dec 7, 2023): > In my scene,the backend model is xinrerence and chatglm3-6b-**32k** . dify max_tokens sets to 500 It's no problems when interacting with xinference , content length 2164 Chinese characters (include Prefix_prompt+question), but in dify,the same content (include Prefix_prompt+question) , get the error. Is there any way to adjust this ? the same problem
Author
Owner

@crazywoola commented on GitHub (Dec 7, 2023):

Do we need to upgrade the deps to the latest? @takatost

@crazywoola commented on GitHub (Dec 7, 2023): Do we need to upgrade the deps to the latest? @takatost
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#788