feat: defaulting tool description to the flow description in Flow as Tool (#4873)

defaulting tool description to the flow description
This commit is contained in:
Phil Miesle 2024-11-27 00:48:21 +00:00 • committed by GitHub
commit 2de119b8d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ class FlowToolComponent(LCToolComponent):
StrInput( StrInput(
name="tool_description", name="tool_description",
display_name="Description", display_name="Description",
info="The description of the tool.", info="The description of the tool; defaults to the Flow's description.",
), ),
BoolInput( BoolInput(
name="return_direct", name="return_direct",
@ -93,9 +93,10 @@ class FlowToolComponent(LCToolComponent):
except Exception: # noqa: BLE001 except Exception: # noqa: BLE001
logger.opt(exception=True).warning("Failed to set run_id") logger.opt(exception=True).warning("Failed to set run_id")
inputs = get_flow_inputs(graph) inputs = get_flow_inputs(graph)
tool_description = self.tool_description.strip() if self.tool_description.strip() else flow_data.description
tool = FlowTool( tool = FlowTool(
name=self.tool_name, name=self.tool_name,
description=self.tool_description, description=tool_description,
graph=graph, graph=graph,
return_direct=self.return_direct, return_direct=self.return_direct,
inputs=inputs, inputs=inputs,