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

[BUG]: Web-browsing did not return information because fetch failed #3134

Open
MaTrix986 opened this issue Feb 6, 2025 · 6 comments
Open
Labels
investigating Core team or maintainer will or is currently looking into this issue needs info / can't replicate Issues that require additional information and/or cannot currently be replicated, but possible bug possible bug Bug was reported but is not confirmed or is unable to be replicated.

Comments

@MaTrix986
Copy link

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

After I send:

@agent use web-browsing: search for information about DeepSeek and tell me about its recent news!

my agent return:

@agent: Searching on Google for "DeepSeek recent news"
1/2  Agent @agent invoked. Swapping over to agent chat. Type /exit to exit agent execution loop early.
2/2  [debug]: @agent is attempting to call `web-browsing` tool
3/3  @agent: Searching on Google for "DeepSeek recent news"
Since no information could be found online, I'll try to provide some general guidance on how to proceed.

If you couldn't find any information about "DeepSeek" online, it's possible that:

1. It's a very new or niche topic.
2. The name might be misspelled or not well-known.
3. The project or organization is relatively small and doesn't have an online presence.

Can you please provide more context or details about what DeepSeek is? For example, is it related to AI, research, technology, or something else?

I can try to help you brainstorm ways to find the information you're looking for or suggest alternative search queries.

I checked AnythingLLM's logs:

[backend] info: [TELEMETRY SENT] {"event":"sent_chat","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"multiUserMode":false,"LLMSelection":"lmstudio","Embedder":"native","VectorDbSelection":"lancedb","multiModal":false,"TTSSelection":"native","runtime":"desktop"}}
[backend] info: [Event Logged] - sent_chat
[backend] info: [AgentHandler] Start d4307986-0791-4bc3-a30e-96a45c0e4cc5::lmstudio:llama3.1-8b
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"runtime":"desktop"}}
[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: [AgentHandler] Attached web-browsing plugin to Agent cluster
[backend] info: [AgentHandler] Attached save-file-to-browser plugin to Agent cluster
[backend] info: [AgentLLM - llama3.1-8b] Valid tool call found - running web-browsing.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call `web-browsing` tool
[backend] info: TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11457:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object._googleSearchEngine (D:\AnythingLLM\resources\backend\server.js:275:528)
    at async Object.search (D:\AnythingLLM\resources\backend\server.js:274:4954)
    at async Object.handler (D:\AnythingLLM\resources\backend\server.js:274:4196)
    at async Xi.handleExecution (D:\AnythingLLM\resources\backend\server.js:274:838)
    at async Xi.reply (D:\AnythingLLM\resources\backend\server.js:274:274)
    at async Xi.chat (D:\AnythingLLM\resources\backend\server.js:255:32084)
    at async Xi.start (D:\AnythingLLM\resources\backend\server.js:255:31518)
    at async UP (D:\AnythingLLM\resources\backend\server.js:308:2717)
[backend] info: [AgentLLM - llama3.1-8b] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - llama3.1-8b] Will assume chat completion without tool call inputs.
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"runtime":"desktop"}}

And I don't know what typeError: fetch failed and the part after that means in there. I've read https://docs.anythingllm.com/fetch-failed-on-upload and followed the three steps in the article to check, but I'm not sure if this has anything to do with the above reported error.

I checked LMStudio's logs:

2025-02-06 11:53:47 [DEBUG] 
Received request: POST to /v1/chat/completions with body  {
  "model": "llama3.1-8b",
  "temperature": 0,
  "messages": [
    {
      "content": "You are a program which picks the most optimal fun... <Truncated in logs> ...st user message and the given conversation so far.",
      "role": "system"
    },
    {
      "content": "@agent use web-browsing: search for information about DeepSeek and tell me about its recent news!",
      "role": "user"
    }
  ]
}
2025-02-06 11:53:47  [INFO] 
[LM STUDIO SERVER] Running chat completion on conversation with 2 messages.
2025-02-06 11:54:22  [INFO] 
[LM STUDIO SERVER] Accumulating tokens ... (stream = false)
2025-02-06 11:54:28 [DEBUG] 
[llama3.1-8b] Accumulated 16 tokens {"name":"web-browsing","arguments":{"query":"DeepSeek recent news"}}
2025-02-06 11:54:28 [DEBUG] 
llama_perf_context_print:        load time =    8208.84 ms
llama_perf_context_print: prompt eval time =   34756.27 ms /  1366 tokens (   25.44 ms per token,    39.30 tokens per second)
llama_perf_context_print:        eval time =    6674.24 ms /    16 runs   (  417.14 ms per token,     2.40 tokens per second)
llama_perf_context_print:       total time =   41480.58 ms /  1382 tokens
2025-02-06 11:54:29  [INFO] 
[LM STUDIO SERVER] [llama3.1-8b] Generated prediction:  {
  "id": "chatcmpl-qxq1mxhw1rcou4z4iasl7",
  "object": "chat.completion",
  "created": 1738814027,
  "model": "llama3.1-8b",
  "choices": [
    {
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "{\"name\":\"web-browsing\",\"arguments\":{\"query\":\"DeepSeek recent news\"}}"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 1368,
    "completion_tokens": 16,
    "total_tokens": 1384
  },
  "system_fingerprint": "llama3.1-8b"
}
2025-02-06 11:54:46  [INFO] 
[LM STUDIO SERVER] Client disconnected. Stopping generation... (If the model is busy processing the prompt, it will finish first.)
2025-02-06 11:54:46 [DEBUG] 
Received request: POST to /v1/chat/completions with body  {
  "model": "llama3.1-8b",
  "messages": [
    {
      "content": "You are a helpful ai assistant who can assist the ... <Truncated in logs> ...ntext available to you and your general knowledge.",
      "role": "system"
    },
    {
      "content": "@agent use web-browsing: search for information ab... <Truncated in logs> ...\nNo information was found online for the search.",
      "role": "user"
    }
  ]
}
2025-02-06 11:54:46  [INFO] 
[LM STUDIO SERVER] Running chat completion on conversation with 2 messages.
2025-02-06 11:54:47  [INFO] 
[LM STUDIO SERVER] Accumulating tokens ... (stream = false)
2025-02-06 11:55:17 [DEBUG] 
[llama3.1-8b] Accumulated 135 tokens Since no information could be found online, I'll try to provide some general guidance on how to proceed.\n\nIf you couldn't find any information about "DeepSeek" online, it's possible that:\n\n1. It's a very new or niche topic.\n2. The name might be misspelled or not well-known.\n3. The project or organization is relatively small and doesn't have an online presence.\n\nCan you please provide more context or details about what DeepSeek is? For example, is it related to AI, research, technology, or something else?\n\nI can try to help you brainstorm ways to find the information you're looking for or suggest alternative search queries.
2025-02-06 11:55:18 [DEBUG] 
llama_perf_context_print:        load time =    8208.84 ms
llama_perf_context_print: prompt eval time =     836.61 ms /   106 tokens (    7.89 ms per token,   126.70 tokens per second)
llama_perf_context_print:        eval time =   30569.15 ms /   135 runs   (  226.44 ms per token,     4.42 tokens per second)
llama_perf_context_print:       total time =   31563.34 ms /   241 tokens
2025-02-06 11:55:18  [INFO] 
[LM STUDIO SERVER] [llama3.1-8b] Generated prediction:  {
  "id": "chatcmpl-pdvt5k4o2kij8qfo6rlsi",
  "object": "chat.completion",
  "created": 1738814086,
  "model": "llama3.1-8b",
  "choices": [
    {
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "Since no information could be found online, I'll try to provide some general guidance on how to proceed.\n\nIf you couldn't find any information about \"DeepSeek\" online, it's possible that:\n\n1. It's a very new or niche topic.\n2. The name might be misspelled or not well-known.\n3. The project or organization is relatively small and doesn't have an online presence.\n\nCan you please provide more context or details about what DeepSeek is? For example, is it related to AI, research, technology, or something else?\n\nI can try to help you brainstorm ways to find the information you're looking for or suggest alternative search queries."
      }
    }
  ],
  "usage": {
    "prompt_tokens": 114,
    "completion_tokens": 135,
    "total_tokens": 249
  },
  "system_fingerprint": "llama3.1-8b"
}
2025-02-06 11:55:18  [INFO] 
[LM STUDIO SERVER] Client disconnected. Stopping generation... (If the model is busy processing the prompt, it will finish first.)

This seems to indicate that web-browsing is not returning any information. I use Google Search Engine API, and I've tested it on other scenarios on my computer and it does work.

After I changed the search engine to DuckDuckGo, web-browsing still didn't work properly, but there was a slight change in the errors reported:
fecth failed in AnythingLLM's logs disappeared.

[backend] info: [AgentHandler] Start e16bef35-ebc9-4973-9907-a4428d32403a::lmstudio:llama3.1-8b
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"runtime":"desktop"}}
[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: [AgentHandler] Attached web-browsing plugin to Agent cluster
[backend] info: [AgentHandler] Attached save-file-to-browser plugin to Agent cluster
[backend] info: [AgentLLM - llama3.1-8b] Valid tool call found - running web-browsing.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call `web-browsing` tool
[backend] info: [AgentLLM - llama3.1-8b] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - llama3.1-8b] Will assume chat completion without tool call inputs.
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"runtime":"desktop"}}

but fetch failed reappeared in LMStudio's logs.

[2025-02-06 12:53:54][DEBUG] Received request: POST to /v1/chat/completions with body {
  "model": "llama3.1-8b",
  "messages": [
    {
      "content": "You are a helpful ai assistant who can assist the user and use tools available to help answer the users prompts and questions. Tools will be handled by another assistant and you will simply receive their responses to help answer the user prompt - always try to answer the user's prompt the best you can with the context available to you and your general knowledge.",
      "role": "system"
    },
    {
      "content": "@agent use web-browsing: search for information about DeepSeek and tell me about its recent news!\nThere was an error while calling the function. No data or response was found. Let the user know this was the error: fetch failed",
      "role": "user"
    }
  ]
}

I'm not quite sure how to trace AnythingLLM's fetch failed error, and I don't know why my search engine didn't work with AnythingLLM. Any help appreciated!

Are there known steps to reproduce?

I set LMStudio:llama3.1-8b-instruct-q8_0 as workspace agent LLM provider, and I only turn on Generate & save files to browser and Web Search skills. Letting agent use the web-browsing tool will reproduce this. The rest of the agent functionality is fine.

@MaTrix986 MaTrix986 added the possible bug Bug was reported but is not confirmed or is unable to be replicated. label Feb 6, 2025
@timothycarambat
Copy link
Member

Since we are using web-browsing and not web-scraping we need to ensure that the web search engine you have set up is working. Are you using Google are your web-browsing provider? Swap to DuckDuckGo (free and no config) to see if it works at all with the same query.

If it does, it means the web search provider you have set in the agent tool isn't correct or has the wrong key.

@timothycarambat timothycarambat added needs info / can't replicate Issues that require additional information and/or cannot currently be replicated, but possible bug investigating Core team or maintainer will or is currently looking into this issue labels Feb 6, 2025
@MaTrix986
Copy link
Author

yeah, both Google and DuckDuckGo didn't work. After I changed the search engine to DuckDuckGo, web-browsing still didn't work properly, but there was a slight change in the errors reported:
fecth failed in AnythingLLM's logs disappeared.

[backend] info: [AgentHandler] Start e16bef35-ebc9-4973-9907-a4428d32403a::lmstudio:llama3.1-8b
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_started","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"runtime":"desktop"}}
[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: [AgentHandler] Attached web-browsing plugin to Agent cluster
[backend] info: [AgentHandler] Attached save-file-to-browser plugin to Agent cluster
[backend] info: [AgentLLM - llama3.1-8b] Valid tool call found - running web-browsing.
[backend] info: [AgentHandler] [debug]: @agent is attempting to call `web-browsing` tool
[backend] info: [AgentLLM - llama3.1-8b] Function tool with exact arguments has already been called this stack.
[backend] info: [AgentLLM - llama3.1-8b] Will assume chat completion without tool call inputs.
[backend] info: [TELEMETRY SENT] {"event":"agent_chat_sent","distinctId":"bd13246d-646f-4806-a39d-bb8383546742","properties":{"runtime":"desktop"}}

but fetch failed reappeared in LMStudio's logs.

[2025-02-06 12:53:54][DEBUG] Received request: POST to /v1/chat/completions with body {
  "model": "llama3.1-8b",
  "messages": [
    {
      "content": "You are a helpful ai assistant who can assist the user and use tools available to help answer the users prompts and questions. Tools will be handled by another assistant and you will simply receive their responses to help answer the user prompt - always try to answer the user's prompt the best you can with the context available to you and your general knowledge.",
      "role": "system"
    },
    {
      "content": "@agent use web-browsing: search for information about DeepSeek and tell me about its recent news!\nThere was an error while calling the function. No data or response was found. Let the user know this was the error: fetch failed",
      "role": "user"
    }
  ]
}

@MaTrix986
Copy link
Author

MaTrix986 commented Feb 6, 2025

My network status is able to search on edge and Chrome using Google and DuckDuckGo, and the Google API seems to work properly on curl as well.

@timothycarambat
Copy link
Member

timothycarambat commented Feb 6, 2025

So in the first dump of logs from LMStudio we can see this:

  "content": "@agent use web-browsing: search for information ab... <Truncated in logs> ...\nNo information was found online for the search.",

Which is this line in the tool:
https://github.com/Mintplex-Labs/allm-desktop/blob/b9197e7df2a57df80ecfedf9675c957212b26446/server/utils/agents/aibitat/plugins/web-browsing.js#L135

Which aligns with this AnythingLLM log

at async Object._googleSearchEngine (D:\AnythingLLM\resources\backend\server.js:275:528)

Since we get No information was found this would indicate a key error or something else. That being said, I will add logging to this skill so we can further debug this failure to call. No chance you are on a VPN or something the could potentially be being blocked by the providers?

Worth also asking if you are on Proxmox on Windows. No idea why but that setup seems to give infinite problems in various areas of the app when it comes to requests. This would make sense why a browser client or cURL might work but fetch wont.

Will add that now and we can debug further once that is in the desktop app. Look for 1.7.4 release

@MaTrix986
Copy link
Author

Yes, I use a VPN and can access Google or DuckDuckGo properly only when I turn on the VPN. but after my testing, AnythingLLM and LMStudio report the same error whether the VPN is turned on or off.

Some posts indicate that maybe code network does not go through a VPN. I also found that my VPN (in Global mode) request logs are not showing anything when using web-browsing (while web-scraping is working properly, the request logs show successfully connected sites). So I suspect that the VPN is not actually working for web-browsing.

Thanks for the update. I'll keep debugging.

@timothycarambat
Copy link
Member

Ah that most definitely is the root cause then. We simply use fetch here, which would not use the proxy/VPN. That for sure is the issue. Im not sure how we can get around that detail though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating Core team or maintainer will or is currently looking into this issue needs info / can't replicate Issues that require additional information and/or cannot currently be replicated, but possible bug possible bug Bug was reported but is not confirmed or is unable to be replicated.
Projects
None yet
Development

No branches or pull requests

2 participants