refactor: Tool Output Management: Add Component-Specific Variable for Conditional Tool Output (#4259)
Implement conditional tool output handling - Updated `component.py` to check for `FEATURE_FLAGS.add_toolkit_output` and call `_append_tool_output` if the component has the `add_tool_output` attribute set to True. - Ensured that the tool output behavior is correctly managed based on feature flags and component attributes in `custom_component.py`.
This commit is contained in:
parent
4075212c34
commit
5811857ca2
3 changed files with 21 additions and 4 deletions
|
|
@ -91,9 +91,9 @@ class Component(CustomComponent):
|
|||
self.__inputs = inputs
|
||||
self.__config = config
|
||||
self._reset_all_output_values()
|
||||
if FEATURE_FLAGS.add_toolkit_output and hasattr(self, "_append_tool_output"):
|
||||
self._append_tool_output()
|
||||
super().__init__(**config)
|
||||
if (FEATURE_FLAGS.add_toolkit_output) and hasattr(self, "_append_tool_output") and self.add_tool_output:
|
||||
self._append_tool_output()
|
||||
if hasattr(self, "_trace_type"):
|
||||
self.trace_type = self._trace_type
|
||||
if not hasattr(self, "trace_type"):
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class CustomComponent(BaseComponent):
|
|||
is_input: bool | None = None
|
||||
"""The input state of the component. Defaults to None.
|
||||
If True, the component must have a field named 'input_value'."""
|
||||
add_tool_output: bool | None = False
|
||||
"""Indicates whether the component will be treated as a tool. Defaults to False."""
|
||||
is_output: bool | None = None
|
||||
"""The output state of the component. Defaults to None.
|
||||
If True, the component must have a field named 'input_value'."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue