langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
36.52k stars 4.95k forks source link

Tool invoke error #4325

Open ptrprkrz opened 1 month ago

ptrprkrz commented 1 month ago

Self Checks

Dify version

0.6.7

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Search web with duckduckgo tool

✔️ Expected Behavior

Retrieved information from a duckduckgo search

❌ Actual Behavior

REQUEST TO DUCKDUCKGO_SEARCH {"duckduckgo_search": {"query": "openai news tomorrow"}} RESPONSE FROM DUCKDUCKGO_SEARCH {"duckduckgo_search": "tool invoke error: https://links.duckduckgo.com/d.js?q=openai+news+tomorrow&kl=wt-wt&l=wt-wt&p=&s=0&df=y&vqd=4-81530519592241638441885684796925095938&ex=-1 202"}

dosubot[bot] commented 1 month ago

The error you're encountering with the Dify tool when trying to use the DuckDuckGo search tool seems to be related to the handling of the request to DuckDuckGo's API, indicated by the HTTP status code "202" in the error message. This suggests that the request was accepted but not completed; a condition that might not be directly related to credential issues, as DuckDuckGo's API for searches typically does not require specific user credentials.

To address this issue, it's important to look into how Dify handles tool invocations and errors. The platform logs details about tool invocations in the tool_model_invokes table, which can be a valuable resource for debugging. Errors during tool invocation are managed by catching exceptions and reporting them, which means that the specific error message you're seeing is part of Dify's error handling mechanism.

For a more immediate solution, consider checking the network connectivity and configuration settings for the DuckDuckGo tool within Dify. Ensure that there are no network issues or timeouts that could be causing the tool invocation to fail. Additionally, reviewing the Dify platform's documentation on handling tool invocations and errors might provide further insights into resolving the issue.

If the problem persists, examining the logs in the tool_model_invokes table could offer more detailed information on why the invocation is failing. This approach will help in identifying whether the issue is with the request parameters, network connectivity, or something else within the Dify tool's handling of external tool invocations.

#### Details **Sources** - [api/core/tools/provider/builtin/duckduckgo/duckduckgo.py](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/duckduckgo/duckduckgo.py) - [api/core/tools/provider/builtin/duckduckgo/tools/duckduckgo_search.yaml](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/duckduckgo/tools/duckduckgo_search.yaml) - [api/core/tools/tool_engine.py](https://github.com/langgenius/dify/blob/main/api/core/tools/tool_engine.py) - [api/core/tools/provider/builtin/duckduckgo/tools/duckduckgo_search.py](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/duckduckgo/tools/duckduckgo_search.py) - [api/migrations/versions/c71211c8f604_add_tool_invoke_model_log.py](https://github.com/langgenius/dify/blob/main/api/migrations/versions/c71211c8f604_add_tool_invoke_model_log.py)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

patryk20120 commented 1 month ago

After upgrading I have 202 Ratelimit which is strange because there is only one request being sent

saddestboy commented 1 month ago

I met the same problem telling me 202.

{"duckduckgo_search": "tool invoke error: https://links.duckduckgo.com/d.js?q=origin+of+the+letter+A&kl=wt-wt&l=wt-wt&p=&s=0&df=y&vqd=4-138105515496736000197279088754094215604&ex=-1 202"}
kota-iizuka commented 1 month ago

This problem seems to be caused by a lower version of duckduckgo-search==5.2.2. A minimal example that reproduces the same error is as follows:

>>> from duckduckgo_search import DDGS
>>> DDGS().text("llm")
duckduckgo_search.exceptions.RatelimitException: https://links.duckduckgo.com/d.js?q=llm&kl=wt-wt&l=wt-wt&p=&s=0&df=&vqd=4-329897...&ex=-1 202

This bug can be fixed by updating duckduckgo-search==6.1.0.

>>> DDGS().text("llm")
[{'title': 'Large language model - Wikipedia', 'href': 'https://en.wikipedia.org/wiki/Large_language_model', 'body': 'A large language model (LLM) is a computational model ...
kiron111 commented 3 weeks ago

they do it intensionally, force the customer to buy their online service.... DAMN....even the searxng docker installation.... they add a -rm command on the documetation, so it will remove everytime after you reboot.... and everyone docker build command, without noticing which working directory is , but they set trap on you -v "${PWD}/searxng:/etc/searxng" \ , so you cant find the settings.yml afterwards..... and the google search....actually almost a free service provide by google....they give you only 100 free search by month (not even by day)