[GH-ISSUE #1944] [HELP] document-summarizer error message for some PDF files #1260

Closed
opened 2026-02-22 18:23:58 -05:00 by yindo · 2 comments
Owner

Originally created by @CedricGoby on GitHub (Jul 24, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1944

Hi,

I'm using the docker version of Anything LLM and Chroma

mintplexlabs/anythingllm:master
chromadb/chroma:0.5.1.dev173

The docker host is a small VM with 2 CPU, 4 Go RAM and no GPU.

The LLM is "mistral-large-2204", the vector database is "Chroma" and the embedder is the default "AnythingLLM Embedder".

I have 2 PDF files in my workspace : a small one and a bigger one.

If I ask the agent to summarize those PDF files it works for the small one :

[backend] info: [TELEMETRY SENT] {"event":"sent_chat","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"multiUserMode":false,"LLMSelection":"mistral","Embedder":"native","VectorDbSelection":"chroma","runtime":"docker"}}
[backend] info: [Event Logged] - sent_chat
[backend] info: [AgentHandler] Start 74e19caa-0964-40e5-bbf3-c7234e577ead::mistral:mistral-large-2402
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}}
[backend] info: [AgentHandler] Attached websocket plugin to Agent cluster
[backend] info: [AgentHandler] Attached chat-history plugin to Agent cluster
[backend] info: [AgentHandler] Attaching user and default agent to Agent cluster.
[backend] info: [AgentHandler] Attached rag-memory plugin to Agent cluster
[backend] info: [AgentHandler] Attached document-summarizer plugin to Agent cluster
[backend] info: [AgentHandler] Attached web-scraping plugin to Agent cluster
[backend] info: [AgentLLM - mistral-large-2402] Valid tool call found - running document-summarizer.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call `document-summarizer` tool
[backend] info: [AgentLLM - mistral-large-2402] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - mistral-large-2402] Will assume chat completion without tool call inputs.
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}}
[backend] info: [AgentLLM - mistral-large-2402] Valid tool call found - running document-summarizer.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call `document-summarizer` tool
[backend] info: [AgentLLM - mistral-large-2402] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - mistral-large-2402] Will assume chat completion without tool call inputs.
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}}

But there is an error for the bigger PDF file :

[backend] info: [TELEMETRY SENT] {"event":"sent_chat","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"multiUserMode":false,"LLMSelection":"mistral","Embedder":"native","VectorDbSelection":"chroma","runtime":"docker"}}
[backend] info: [Event Logged] - sent_chat
[backend] info: [AgentHandler] Start 4cb58d33-0893-4826-9571-573677d9446d::mistral:mistral-large-2402
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}}
[backend] info: [AgentHandler] Attached websocket plugin to Agent cluster
[backend] info: [AgentHandler] Attached chat-history plugin to Agent cluster
[backend] info: [AgentHandler] Attaching user and default agent to Agent cluster.
[backend] info: [AgentHandler] Attached rag-memory plugin to Agent cluster
[backend] info: [AgentHandler] Attached document-summarizer plugin to Agent cluster
[backend] info: [AgentHandler] Attached web-scraping plugin to Agent cluster
[backend] info: [AgentLLM - mistral-large-2402] Valid tool call found - running document-summarizer.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call `document-summarizer` tool
Failed to calculate number of tokens, falling back to approximate count Error: Unknown model
    at getEncodingNameForModel (/app/server/node_modules/js-tiktoken/dist/lite.cjs:230:13)
    at encodingForModel (/app/server/node_modules/@langchain/core/dist/utils/tiktoken.cjs:23:59)
    at ChatOpenAI.getNumTokens (/app/server/node_modules/@langchain/core/dist/language_models/base.cjs:182:75)
    at LLMChain._getNumTokens (/app/server/node_modules/langchain/dist/chains/llm_chain.cjs:212:44)
    at MapReduceDocumentsChain._call (/app/server/node_modules/langchain/dist/chains/combine_docs_chain.cjs:180:73)
    at async MapReduceDocumentsChain.invoke (/app/server/node_modules/langchain/dist/chains/base.cjs:58:28)
    at async summarizeContent (/app/server/utils/agents/aibitat/utils/summarize.js:55:15)
    at async Object.summarizeDoc (/app/server/utils/agents/aibitat/plugins/summarize.js:157:22)
    at async Object.handler (/app/server/utils/agents/aibitat/plugins/summarize.js:63:22)
    at async AIbitat.handleExecution (/app/server/utils/agents/aibitat/index.js:630:22)
[backend] error: (node:112) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
[backend] info: [AgentHandler] document-summarizer.summarizeDoc raised an error. 422 status code (no body)
[backend] info: [AgentLLM - mistral-large-2402] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - mistral-large-2402] Will assume chat completion without tool call inputs.
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}}

Can you help me to understand what's wrong in that case ?

Regards

Originally created by @CedricGoby on GitHub (Jul 24, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1944 Hi, I'm using the docker version of Anything LLM and Chroma ``` mintplexlabs/anythingllm:master chromadb/chroma:0.5.1.dev173 ``` The docker host is a small VM with 2 CPU, 4 Go RAM and no GPU. The LLM is "mistral-large-2204", the vector database is "Chroma" and the embedder is the default "AnythingLLM Embedder". I have 2 PDF files in my workspace : a small one and a bigger one. If I ask the agent to summarize those PDF files it works for the small one : ``` [backend] info: [TELEMETRY SENT] {"event":"sent_chat","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"multiUserMode":false,"LLMSelection":"mistral","Embedder":"native","VectorDbSelection":"chroma","runtime":"docker"}} [backend] info: [Event Logged] - sent_chat [backend] info: [AgentHandler] Start 74e19caa-0964-40e5-bbf3-c7234e577ead::mistral:mistral-large-2402 [backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}} [backend] info: [AgentHandler] Attached websocket plugin to Agent cluster [backend] info: [AgentHandler] Attached chat-history plugin to Agent cluster [backend] info: [AgentHandler] Attaching user and default agent to Agent cluster. [backend] info: [AgentHandler] Attached rag-memory plugin to Agent cluster [backend] info: [AgentHandler] Attached document-summarizer plugin to Agent cluster [backend] info: [AgentHandler] Attached web-scraping plugin to Agent cluster [backend] info: [AgentLLM - mistral-large-2402] Valid tool call found - running document-summarizer. [backend] info: [AgentHandler] [debug]: @agent is attempting to call `document-summarizer` tool [backend] info: [AgentLLM - mistral-large-2402] Function tool with exact arguments has already been called this stack. [backend] info: [AgentLLM - mistral-large-2402] Will assume chat completion without tool call inputs. [backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}} [backend] info: [AgentLLM - mistral-large-2402] Valid tool call found - running document-summarizer. [backend] info: [AgentHandler] [debug]: @agent is attempting to call `document-summarizer` tool [backend] info: [AgentLLM - mistral-large-2402] Function tool with exact arguments has already been called this stack. [backend] info: [AgentLLM - mistral-large-2402] Will assume chat completion without tool call inputs. [backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}} ``` But there is an error for the bigger PDF file : ``` [backend] info: [TELEMETRY SENT] {"event":"sent_chat","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"multiUserMode":false,"LLMSelection":"mistral","Embedder":"native","VectorDbSelection":"chroma","runtime":"docker"}} [backend] info: [Event Logged] - sent_chat [backend] info: [AgentHandler] Start 4cb58d33-0893-4826-9571-573677d9446d::mistral:mistral-large-2402 [backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}} [backend] info: [AgentHandler] Attached websocket plugin to Agent cluster [backend] info: [AgentHandler] Attached chat-history plugin to Agent cluster [backend] info: [AgentHandler] Attaching user and default agent to Agent cluster. [backend] info: [AgentHandler] Attached rag-memory plugin to Agent cluster [backend] info: [AgentHandler] Attached document-summarizer plugin to Agent cluster [backend] info: [AgentHandler] Attached web-scraping plugin to Agent cluster [backend] info: [AgentLLM - mistral-large-2402] Valid tool call found - running document-summarizer. [backend] info: [AgentHandler] [debug]: @agent is attempting to call `document-summarizer` tool Failed to calculate number of tokens, falling back to approximate count Error: Unknown model at getEncodingNameForModel (/app/server/node_modules/js-tiktoken/dist/lite.cjs:230:13) at encodingForModel (/app/server/node_modules/@langchain/core/dist/utils/tiktoken.cjs:23:59) at ChatOpenAI.getNumTokens (/app/server/node_modules/@langchain/core/dist/language_models/base.cjs:182:75) at LLMChain._getNumTokens (/app/server/node_modules/langchain/dist/chains/llm_chain.cjs:212:44) at MapReduceDocumentsChain._call (/app/server/node_modules/langchain/dist/chains/combine_docs_chain.cjs:180:73) at async MapReduceDocumentsChain.invoke (/app/server/node_modules/langchain/dist/chains/base.cjs:58:28) at async summarizeContent (/app/server/utils/agents/aibitat/utils/summarize.js:55:15) at async Object.summarizeDoc (/app/server/utils/agents/aibitat/plugins/summarize.js:157:22) at async Object.handler (/app/server/utils/agents/aibitat/plugins/summarize.js:63:22) at async AIbitat.handleExecution (/app/server/utils/agents/aibitat/index.js:630:22) [backend] error: (node:112) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit (Use `node --trace-warnings ...` to show where the warning was created) [backend] info: [AgentHandler] document-summarizer.summarizeDoc raised an error. 422 status code (no body) [backend] info: [AgentLLM - mistral-large-2402] Function tool with exact arguments has already been called this stack. [backend] info: [AgentLLM - mistral-large-2402] Will assume chat completion without tool call inputs. [backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"0ecf90ec-3ef0-4b37-97a6-bc15ff5d91b4","properties":{"runtime":"docker"}} ``` Can you help me to understand what's wrong in that case ? Regards
yindo closed this issue 2026-02-22 18:23:58 -05:00
Author
Owner

@timothycarambat commented on GitHub (Jul 24, 2024):

🤔 Hm, this is weird. Looks like the looping or failing to do the recursive summarization due to the model context being overflow but then being unable to even estimate tokens.

[backend] error: (node:112) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit

Is actually normal and is coming from langchain - so the real issue is why LC cannot do the fallback calculation on tokens.

@timothycarambat commented on GitHub (Jul 24, 2024): 🤔 Hm, this is weird. Looks like the looping or failing to do the recursive summarization due to the model context being overflow but then being unable to even estimate tokens. > [backend] error: (node:112) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit Is actually normal and is coming from langchain - so the real issue is why LC cannot do the fallback calculation on tokens.
Author
Owner

@timothycarambat commented on GitHub (Jul 24, 2024):

Looks like this was patched in later version of @langchain/community or @langchain/core so we need to bump those deps to patch this

@timothycarambat commented on GitHub (Jul 24, 2024): Looks like this was patched in later version of @langchain/community or @langchain/core so we need to bump those deps to patch this
yindo changed title from [HELP] document-summarizer error message for some PDF files to [GH-ISSUE #1944] [HELP] document-summarizer error message for some PDF files 2026-06-05 14:39:48 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1260