Closed AkisAya closed 13 minutes ago
Hello, @AkisAya! I'm here to help you with bug fixes, answer your questions, and assist you in becoming a contributor. If you need any assistance, feel free to ask!
To resolve the runtime error caused by the missing 'warning' argument in the auto_parse_to_tool_bundle
method, you need to provide a warning
argument when calling the method. You can pass an empty dictionary if no warnings are needed. Here's how you can modify the convert_schema_to_tool_bundles
method:
@staticmethod
def convert_schema_to_tool_bundles(schema: str, extra_info: Optional[dict] = None) -> list[ApiToolBundle]:
"""
convert schema to tool bundles
:return: the list of tool bundles, description
"""
try:
warnings = {}
tool_bundles = ApiBasedToolSchemaParser.auto_parse_to_tool_bundle(schema, extra_info=extra_info, warning=warnings)
return tool_bundles
except Exception as e:
raise ValueError(f"invalid schema: {str(e)}")
This ensures that the warning
parameter is provided, preventing the runtime error [1].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
main
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
update existsing custom tools will throw an Exception, indicating that argument 'warning' is missing.
After reviewing the code, it's due to the missing of default None value when introducing Optional type to function params. e.g.
this change is is introduced by commit: https://github.com/langgenius/dify/commit/240b66d7373f11db378d5b3a67594e5ea1f2fc66
✔️ Expected Behavior
update tools successfully
❌ Actual Behavior
fail to update tools