agent functioncall got PluginInvokeError about : Input should be a valid dictionary or instance of AIModelEntity #9123

Closed
opened 2026-02-21 18:30:54 -05:00 by yindo · 0 comments
Owner

Originally created by @lordk911 on GitHub (Mar 4, 2025).

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

1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1、Register custom tools

openapi: 3.0.0
info:
  title: API服务
  description:  API 接口
  version: 1.0.0
  
servers:
  - url: http://10.9.9.9:8000
    description: 本地开发服务器

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      
  schemas:

    CustomerBase:
      type: object
      properties:
        customer_id:
          type: string
        name:
          type: string
        email:
          type: string
        phone:
          type: string
          
    CustomerDetail:
      allOf:
        - $ref: '#/components/schemas/CustomerBase'
        - type: object
          properties:
            purchase_history:
              type: array
              items:
                type: object
                properties:
                  date:
                    type: string
                    format: date
                  product:
                    type: string
                  amount:
                    type: number
            preferences:
              type: object
              properties:
                favorite_category:
                  type: string
                  
    Error:
      type: object
      properties:
        detail:
          type: string

paths:              
  /customers:
    get:
      summary: 获取客户列表
      operationId: listCustomers
      tags:
        - customers
      security:
        - BearerAuth: []
      responses:
        '200':
          description: 成功获取客户列表
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustomerBase'
        '401':
          description: 未授权访问
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                
  /customers/{customer_id}:
    get:
      summary: 获取客户详细信息
      operationId: getCustomerDetail
      tags:
        - customers
      security:
        - BearerAuth: []
      parameters:
        - name: customer_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: 成功获取客户详细信息
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerDetail'
        '404':
          description: 客户未找到
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                

2、Add an agent node, and the strategy is Functioncall

Image

3、The agent encounters an execution error.

Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"ValidationError","message":"1 validation error for FunctionCallingParams\nmodel.entity\n Input should be a valid dictionary or instance of AIModelEntity [type=model_type, input_value=None, input_type=NoneType]\n For further information visit [https://errors.pydantic.dev/2.8/v/model_type"}](https://errors.pydantic.dev/2.8/v/model_type%22%7D)

model input:

{
  "model": {
    "provider": "langgenius/xinference/xinference",
    "model": "qwen2.5-32B-instruct",
    "model_type": "llm",
    "mode": "chat",
    "completion_params": {},
    "type": "model-selector"
  },
  "tools": [
    {
      "provider_name": "45481b09-60bb-4892-a4b5-36b642c9bc9a",
      "type": "api",
      "tool_name": "listCustomers",
      "tool_label": "listCustomers",
      "settings": {},
      "parameters": {},
      "enabled": true,
      "extra": {
        "description": ""
      }
    },
    {
      "provider_name": "45481b09-60bb-4892-a4b5-36b642c9bc9a",
      "type": "api",
      "tool_name": "getCustomerDetail",
      "tool_label": "getCustomerDetail",
      "settings": {},
      "parameters": {
        "customer_id": null
      },
      "enabled": true,
      "extra": {
        "description": ""
      }
    },
    {
      "provider_name": "45481b09-60bb-4892-a4b5-36b642c9bc9a",
      "type": "api",
      "tool_name": "getCustomerPreferences",
      "tool_label": "getCustomerPreferences",
      "settings": {},
      "parameters": {
        "customer_id": null
      },
      "enabled": true,
      "extra": {
        "description": ""
      }
    }
  ],
  "instruction": "尝试使用工具列表中的工具,解决用户问题",
  "query": "查询张三的信息"
}

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @lordk911 on GitHub (Mar 4, 2025). ### 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 1.0.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1、Register custom tools ``` openapi: 3.0.0 info: title: API服务 description: API 接口 version: 1.0.0 servers: - url: http://10.9.9.9:8000 description: 本地开发服务器 components: securitySchemes: BearerAuth: type: http scheme: bearer bearerFormat: JWT schemas: CustomerBase: type: object properties: customer_id: type: string name: type: string email: type: string phone: type: string CustomerDetail: allOf: - $ref: '#/components/schemas/CustomerBase' - type: object properties: purchase_history: type: array items: type: object properties: date: type: string format: date product: type: string amount: type: number preferences: type: object properties: favorite_category: type: string Error: type: object properties: detail: type: string paths: /customers: get: summary: 获取客户列表 operationId: listCustomers tags: - customers security: - BearerAuth: [] responses: '200': description: 成功获取客户列表 content: application/json: schema: type: array items: $ref: '#/components/schemas/CustomerBase' '401': description: 未授权访问 content: application/json: schema: $ref: '#/components/schemas/Error' /customers/{customer_id}: get: summary: 获取客户详细信息 operationId: getCustomerDetail tags: - customers security: - BearerAuth: [] parameters: - name: customer_id in: path required: true schema: type: string responses: '200': description: 成功获取客户详细信息 content: application/json: schema: $ref: '#/components/schemas/CustomerDetail' '404': description: 客户未找到 content: application/json: schema: $ref: '#/components/schemas/Error' ``` **2、Add an agent node, and the strategy is Functioncall** ![Image](https://github.com/user-attachments/assets/9c5242eb-cd39-4bb0-8b9a-40068b862c98) **3、The agent encounters an execution error.** `Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"ValidationError","message":"1 validation error for FunctionCallingParams\nmodel.entity\n Input should be a valid dictionary or instance of AIModelEntity [type=model_type, input_value=None, input_type=NoneType]\n For further information visit [https://errors.pydantic.dev/2.8/v/model_type"}](https://errors.pydantic.dev/2.8/v/model_type%22%7D)` **model input:** ``` { "model": { "provider": "langgenius/xinference/xinference", "model": "qwen2.5-32B-instruct", "model_type": "llm", "mode": "chat", "completion_params": {}, "type": "model-selector" }, "tools": [ { "provider_name": "45481b09-60bb-4892-a4b5-36b642c9bc9a", "type": "api", "tool_name": "listCustomers", "tool_label": "listCustomers", "settings": {}, "parameters": {}, "enabled": true, "extra": { "description": "" } }, { "provider_name": "45481b09-60bb-4892-a4b5-36b642c9bc9a", "type": "api", "tool_name": "getCustomerDetail", "tool_label": "getCustomerDetail", "settings": {}, "parameters": { "customer_id": null }, "enabled": true, "extra": { "description": "" } }, { "provider_name": "45481b09-60bb-4892-a4b5-36b642c9bc9a", "type": "api", "tool_name": "getCustomerPreferences", "tool_label": "getCustomerPreferences", "settings": {}, "parameters": { "customer_id": null }, "enabled": true, "extra": { "description": "" } } ], "instruction": "尝试使用工具列表中的工具,解决用户问题", "query": "查询张三的信息" } ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🤖 feat:agent🔨 feat:tools labels 2026-02-21 18:30:54 -05:00
yindo closed this issue 2026-02-21 18:30:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#9123