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
49.3k stars 7.06k forks source link

Custom Tool's parameters doesn't support object type. #9443

Open Dofine-dufei opened 1 week ago

Dofine-dufei commented 1 week ago

Self Checks

Dify version

0.9.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

1.set parameter type as object in Custom Tool's schema. 2.test or generate a agent, found that parameter changed to a string type.

✔️ Expected Behavior

I wish tool's parameters support object type in Custom Tool.

❌ Actual Behavior

The tool's parameters changed to string type, actually it's object type.

dosubot[bot] commented 1 week ago

There is a known issue where the Custom Tool's parameters change from object type to string type when set in the schema. This behavior is due to the ToolParameterConverter class's get_parameter_type method, which maps several parameter types, including ToolParameter.ToolParameterType.STRING, ToolParameter.ToolParameterType.SECRET_INPUT, and ToolParameter.ToolParameterType.SELECT, to the string type. This mapping is likely done to standardize these parameter types as strings within the schema [1].

Currently, there is no documentation or code comments explaining why object types are not supported as parameters in custom tools, nor are there any existing workarounds or extensions in the Dify codebase that allow for object types to be used as parameters in custom tools [1].

To continue talking to Dosu, mention @dosu.