Skip to content

Commit 0b9b564

Browse files
revert changes
1 parent 5bb885a commit 0b9b564

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

atomic-agents/atomic_agents/base/base_tool.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,6 @@ class BaseTool[InputSchema: BaseIOSchema, OutputSchema: BaseIOSchema](ABC):
3838
tool_description (str): Description of the tool, derived from the input schema's description or overridden by the config.
3939
"""
4040

41-
def __init_subclass__(cls, **kwargs):
42-
"""
43-
Hook called when a class is subclassed.
44-
45-
Captures generic type parameters during class creation and stores them as class attributes
46-
to work around the unreliable __orig_class__ attribute in modern Python generic syntax.
47-
"""
48-
super().__init_subclass__(**kwargs)
49-
if hasattr(cls, "__orig_bases__"):
50-
for base in cls.__orig_bases__:
51-
if hasattr(base, "__origin__") and base.__origin__ is BaseTool:
52-
args = get_args(base)
53-
if len(args) == 2:
54-
cls._input_schema_cls = args[0]
55-
cls._output_schema_cls = args[1]
56-
break
57-
5841
def __init__(self, config: BaseToolConfig = BaseToolConfig()):
5942
"""
6043
Initializes the BaseTool with an optional configuration override.
@@ -72,7 +55,12 @@ def input_schema(self) -> Type[InputSchema]:
7255
Returns:
7356
Type[InputSchema]: The input schema class.
7457
"""
75-
return getattr(self.__class__, "_input_schema_cls", BaseIOSchema)
58+
if hasattr(self, "__orig_class__"):
59+
TI, _ = get_args(self.__orig_class__)
60+
else:
61+
TI = BaseIOSchema
62+
63+
return TI
7664

7765
@property
7866
def output_schema(self) -> Type[OutputSchema]:
@@ -82,7 +70,12 @@ def output_schema(self) -> Type[OutputSchema]:
8270
Returns:
8371
Type[OutputSchema]: The output schema class.
8472
"""
85-
return getattr(self.__class__, "_output_schema_cls", BaseIOSchema)
73+
if hasattr(self, "__orig_class__"):
74+
_, TO = get_args(self.__orig_class__)
75+
else:
76+
TO = BaseIOSchema
77+
78+
return TO
8679

8780
@property
8881
def tool_name(self) -> str:

0 commit comments

Comments
 (0)