@@ -42,7 +42,7 @@ def generate_prompt_tool(name, content, prompt_only=False, source=None):
42
42
message_format = (
43
43
"Generate tool meta failed for {tool_type} tool. Jinja parsing failed: {error_type_and_message}"
44
44
),
45
- tool_type = tool_type ,
45
+ tool_type = tool_type . value ,
46
46
error_type_and_message = error_type_and_message ,
47
47
) from e
48
48
@@ -143,8 +143,11 @@ def _parse_tool_from_function(f, initialize_inputs=None, gen_custom_type_conn=Fa
143
143
f = f .__original_function
144
144
try :
145
145
inputs , _ , _ , enable_kwargs = function_to_interface (
146
- f , initialize_inputs = initialize_inputs , gen_custom_type_conn = gen_custom_type_conn ,
147
- skip_prompt_template = skip_prompt_template )
146
+ f ,
147
+ initialize_inputs = initialize_inputs ,
148
+ gen_custom_type_conn = gen_custom_type_conn ,
149
+ skip_prompt_template = skip_prompt_template ,
150
+ )
148
151
except Exception as e :
149
152
error_type_and_message = f"({ e .__class__ .__name__ } ) { e } "
150
153
raise BadFunctionInterface (
@@ -280,7 +283,7 @@ def generate_tool_meta_dict_by_file(path: str, tool_type: ToolType):
280
283
if not file .is_file ():
281
284
raise MetaFileNotFound (
282
285
message_format = "Generate tool meta failed for {tool_type} tool. Meta file '{file_path}' can not be found." ,
283
- tool_type = tool_type ,
286
+ tool_type = tool_type . value ,
284
287
file_path = str (file ),
285
288
)
286
289
try :
@@ -292,7 +295,7 @@ def generate_tool_meta_dict_by_file(path: str, tool_type: ToolType):
292
295
"Generate tool meta failed for {tool_type} tool. "
293
296
"Read meta file '{file_path}' failed: {error_type_and_message}"
294
297
),
295
- tool_type = tool_type ,
298
+ tool_type = tool_type . value ,
296
299
file_path = str (file ),
297
300
error_type_and_message = error_type_and_message ,
298
301
) from e
0 commit comments