diff --git a/haystack/tools/__init__.py b/haystack/tools/__init__.py index a1871c0f53..90ba022dd6 100644 --- a/haystack/tools/__init__.py +++ b/haystack/tools/__init__.py @@ -3,7 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 -from haystack.tools.component_tool import ComponentTool +# ruff: noqa: I001 (ignore import order as we need to import Tool before ComponentTool) from haystack.tools.tool import Tool, _check_duplicate_tool_names, deserialize_tools_inplace +from haystack.tools.component_tool import ComponentTool -__all__ = ["ComponentTool", "Tool", "_check_duplicate_tool_names", "deserialize_tools_inplace"] +__all__ = ["Tool", "_check_duplicate_tool_names", "deserialize_tools_inplace", "ComponentTool"] diff --git a/haystack/tools/component_tool.py b/haystack/tools/component_tool.py index eeb4118b0b..ae52b919f9 100644 --- a/haystack/tools/component_tool.py +++ b/haystack/tools/component_tool.py @@ -148,7 +148,7 @@ def _create_tool_parameters_schema(self, component: Component) -> Dict[str, Any] param_descriptions = self._get_param_descriptions(component.run) - for input_name, socket in component.__haystack_input__._sockets_dict.items(): + for input_name, socket in component.__haystack_input__._sockets_dict.items(): # type: ignore[attr-defined] input_type = socket.type description = param_descriptions.get(input_name, f"Input '{input_name}' for the component.") @@ -187,10 +187,8 @@ def _get_param_descriptions(self, method: Callable) -> Dict[str, str]: if not param.description: logger.warning( "Missing description for parameter '%s'. Please add a description in the component's " - "run() method docstring using the format ':param %s: '. " - "This description helps the LLM understand how to use this parameter.", - param.arg_name, - param.arg_name, + "run() method docstring using the format ':param %%s: '. " + "This description helps the LLM understand how to use this parameter." % param.arg_name ) param_descriptions[param.arg_name] = param.description.strip() if param.description else "" return param_descriptions