diff --git a/metagpt/tools/functions/libs/udf/__init__.py b/metagpt/tools/functions/libs/udf/__init__.py index c581dd992..e44e97c41 100644 --- a/metagpt/tools/functions/libs/udf/__init__.py +++ b/metagpt/tools/functions/libs/udf/__init__.py @@ -22,11 +22,11 @@ def extract_function_signatures(file_path): # 获取函数签名 function_signature = f"{function_name}({', '.join(args)})" # 导入函数 - module = Path(file_path).parts[-1][:-len(Path(file_path).suffix)] - module = importlib.import_module(f"metagpt.tools.functions.libs.udf.{module}") + module_name = Path(file_path).parts[-1][:-len(Path(file_path).suffix)] + module = importlib.import_module(f"metagpt.tools.functions.libs.udf.{module_name}") # 获取函数注释和函数路径 function_schema = {'name': function_signature, 'doc': inspect.getdoc(getattr(module, function_name)), - 'path': f'from metagpt.tools.functions.libs.udf.{module} import function_name'} + 'path': f'from metagpt.tools.functions.libs.udf.{module_name} import {function_name}'} function_signatures.append(function_schema) return function_signatures