Skip to content

Commit 138c4cb

Browse files
authored
fix: filter out internal tool methods starting with underscore (open-webui#22408)
1 parent 7a3c5c0 commit 138c4cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

backend/open_webui/utils/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,8 @@ def get_functions_from_tool(tool: object) -> list[Callable]:
707707
getattr(tool, func)
708708
) # checks if the attribute is callable (a method or function).
709709
and not func.startswith(
710-
"__"
711-
) # filters out special (dunder) methods like init, str, etc. — these are usually built-in functions of an object that you might not need to use directly.
710+
"_"
711+
) # filters out internal methods (starting with _) and special (dunder) methods.
712712
and not inspect.isclass(
713713
getattr(tool, func)
714714
) # ensures that the callable is not a class itself, just a method or function.

0 commit comments

Comments
 (0)