Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Jan 9, 2025
1 parent dc0abe5 commit d38cc8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions haystack/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
8 changes: 3 additions & 5 deletions haystack/tools/component_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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: <description>'. "
"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: <description>'. "
"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
Expand Down

0 comments on commit d38cc8a

Please sign in to comment.