Dify seems not to parse enums in OpenAPI specification when calling a plugin #3132

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

Originally created by @ifsheldon on GitHub (May 10, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a quesion, 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).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.7

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

iShot_2024-05-10_14 46 57
  1. Add a simple custom plugin light_control, the source code of the plugin is here
  2. Ask GPT to turn off the light
  3. A function calling is emitted but the arguments are wrong while in openapi.json, the acceptable values are listed by enum field.

As far as I know GPT-4-Turbo, it's capable to understand what enum means if the JSON schema for tool calls has this field. So, it seems dify does not parse this field into a proper JSON schema and send to OpenAI.

✔️ Expected Behavior

A proper JSON schema is parsed from openapi.json and sent to OpenAI or any other GPT providers that have function calling support.

Actual Behavior

GPT tries to call the function with guessed values instead of listed acceptable ones.

This issue is further complicated by #3999 .

Originally created by @ifsheldon on GitHub (May 10, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a quesion, 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] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.6.7 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="1235" alt="iShot_2024-05-10_14 46 57" src="https://github.com/langgenius/dify/assets/39153080/1f49920e-fd32-4c47-af27-da7896604c66"> 1. Add a simple custom plugin `light_control`, the source code of the plugin is [here](https://github.com/ifsheldon/gpt_plugin_template_rs) 2. Ask GPT to turn off the light 3. A function calling is emitted but the arguments are wrong while in `openapi.json`, the acceptable values are listed by `enum` field. As far as I know GPT-4-Turbo, it's capable to understand what `enum` means if the JSON schema for tool calls has this field. So, it seems dify does not parse this field into a proper JSON schema and send to OpenAI. ### ✔️ Expected Behavior A proper JSON schema is parsed from `openapi.json` and sent to OpenAI or any other GPT providers that have function calling support. ### ❌ Actual Behavior GPT tries to call the function with guessed values instead of listed acceptable ones. This issue is further complicated by #3999 .
yindo added the 🐞 bug label 2026-02-21 17:54:10 -05:00
yindo closed this issue 2026-02-21 17:54:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#3132