浏览代码

pass docstring to function

Michael Poluektov 8 月之前
父节点
当前提交
5edc211392
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      backend/utils/tools.py

+ 4 - 3
backend/utils/tools.py

@@ -60,9 +60,10 @@ def get_tools(
             function_name = spec["name"]
             function_name = spec["name"]
 
 
             # convert to function that takes only model params and inserts custom params
             # convert to function that takes only model params and inserts custom params
-            callable = apply_extra_params_to_tool_function(
-                getattr(module, function_name), extra_params
-            )
+            original_func = getattr(module, function_name)
+            callable = apply_extra_params_to_tool_function(original_func, extra_params)
+            if hasattr(original_func, "__doc__"):
+                callable.__doc__ = original_func.__doc__
 
 
             # TODO: This needs to be a pydantic model
             # TODO: This needs to be a pydantic model
             tool_dict = {
             tool_dict = {