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
52.61k stars 7.7k forks source link

error occured with agent calling qwen2-instruct model with function tool by xinference provider #11010

Closed cyflhn closed 1 day ago

cyflhn commented 2 days ago

Self Checks

Dify version

0.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. create an agent with tools integrated in dify
  2. add a model provider of xinference and add a model of qwen2-instruct
  3. create prompt in the agent and start a chat message in the agent

✔️ Expected Behavior

A normal response should be generated.

❌ Actual Behavior

An error occured. Here is the log: Server Unavailable Error, Error code: 500 - {'detail': "[address=0.0.0.0:36119, pid=3932702] Tool response dicts require a 'name' key indicating the name of the called function!"}

dosubot[bot] commented 2 days ago

It seems like you're encountering an issue with the qwen2-instruct model integration in Dify, specifically related to the tool response dicts requiring a 'name' key. This error might be due to a misconfiguration in the YAML file or the tool's implementation.

Here's what you can check and do to resolve this issue:

  1. Tool Configuration: Ensure that the tool's YAML configuration file includes the identity section with a name key. This key should uniquely identify the tool and match the expected name in the code. For example, in the GoogleSearch tool, the configuration looks like this:

    identity: # Basic information of the tool
      name: google_search # Tool name, unique, no duplication with other tools
      author: Dify # Author
      label: # Label for frontend display
        en_US: GoogleSearch # English label
        zh_Hans: 谷歌搜索 # Chinese label
  2. Model Configuration: Verify that the qwen2-instruct model is correctly configured in the YAML file. The configuration should include all necessary parameters and properties, such as model, model_type, and features. You can refer to the specific configuration example for qwen2-instruct:

    model: Qwen/Qwen2-1.5B-Instruct
    label:
      en_US: Qwen/Qwen2-1.5B-Instruct
    model_type: llm
    features:
      - agent-thought
    model_properties:
      mode: chat
      context_size: 32768
  3. Error Handling: Ensure that the model invocation code properly handles errors and that the tool response dicts are correctly structured with all required keys, including name.

If these steps do not resolve the issue, you might want to check for any updates or patches in the Dify repository that address this specific error.

To continue talking to Dosu, mention @dosu.