llm always reports an error that the length exceeds the limit #6831

Closed
opened 2026-02-21 18:17:30 -05:00 by yindo · 1 comment
Owner

Originally created by @Vampxgg on GitHub (Nov 19, 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.11.2

Cloud or Self Hosted

Cloud

Steps to reproduce

4ec37fe3-fe7e-4b38-b823-9a2f073c4905

✔️ Expected Behavior

LLM analyzes the content extracted from my document and outputs the data in markdown format to me.

Actual Behavior

I have no problem using regular text to pass in large amounts of text content, but when using the document extractor to extract the uploaded file, it reports that it exceeds MAX_TOKEN. I really want to optimize the document extractor's function.

Originally created by @Vampxgg on GitHub (Nov 19, 2024). ### 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] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.11.2 ### Cloud or Self Hosted Cloud ### Steps to reproduce ![4ec37fe3-fe7e-4b38-b823-9a2f073c4905](https://github.com/user-attachments/assets/910bf6ab-6409-4c30-b7e3-04e776d607e7) ### ✔️ Expected Behavior LLM analyzes the content extracted from my document and outputs the data in markdown format to me. ### ❌ Actual Behavior I have no problem using regular text to pass in large amounts of text content, but when using the document extractor to extract the uploaded file, it reports that it exceeds MAX_TOKEN. I really want to optimize the document extractor's function.
yindo added the 🐞 bug label 2026-02-21 18:17:30 -05:00
yindo closed this issue 2026-02-21 18:17:30 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 19, 2024):

I found some similar discussions and issues related to token limits in Dify:

  1. Error using large language model - This discussion is unsolved and might provide insights into similar token limit issues.
  2. The maximum length should be in terms of token count rather than character count - Another unsolved discussion that touches on token limits.
  3. bug: max_token limit exceeded when change llm - This closed issue discusses a similar problem where the max_tokens parameter was set too high. The solution involved ensuring the max_tokens parameter does not exceed 4096 tokens, which is the operational limit for some models.

To address your issue, you might want to check the configuration of the max_tokens parameter in your document extractor settings. Ensure it aligns with the model's token limit, which is typically 4096 tokens for many models. Adjusting this setting might help optimize the document extractor's function [1][2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 19, 2024): <!-- Answer --> I found some similar discussions and issues related to token limits in Dify: 1. [Error using large language model](https://github.com/langgenius/dify/discussions/10144) - This discussion is unsolved and might provide insights into similar token limit issues. 2. [The maximum length should be in terms of token count rather than character count](https://github.com/langgenius/dify/discussions/3592) - Another unsolved discussion that touches on token limits. 3. [bug: max_token limit exceeded when change llm](https://github.com/langgenius/dify/issues/8027) - This closed issue discusses a similar problem where the `max_tokens` parameter was set too high. The solution involved ensuring the `max_tokens` parameter does not exceed 4096 tokens, which is the operational limit for some models. To address your issue, you might want to check the configuration of the `max_tokens` parameter in your document extractor settings. Ensure it aligns with the model's token limit, which is typically 4096 tokens for many models. Adjusting this setting might help optimize the document extractor's function <sup>[[1]](https://github.com/langgenius/dify/discussions/10144)</sup><sup>[[2]](https://github.com/langgenius/dify/discussions/3592)</sup><sup>[[3]](https://github.com/langgenius/dify/issues/8027)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6831