Skip to content

Commit 5dcfc39

Browse files
committed
fix: Fix nit error + add comment
1 parent 5741205 commit 5dcfc39

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/toolbox-langchain/src/toolbox_langchain/async_tools.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ def __init__(
3838
Args:
3939
core_tool: The underlying core async ToolboxTool instance.
4040
"""
41+
42+
# Due to how pydantic works, we must initialize the underlying
43+
# BaseTool class before assigning values to member variables.
4144
super().__init__(
42-
name=self.__core_tool.__name__,
43-
description=self.__core_tool.__doc__,
44-
args_schema=self.__core_tool._ToolboxTool__pydantic_model,
45+
name=core_tool.__name__,
46+
description=core_tool.__doc__,
47+
args_schema=core_tool._ToolboxTool__pydantic_model,
4548
)
4649
self.__core_tool = core_tool
4750

packages/toolbox-langchain/src/toolbox_langchain/tools.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ def __init__(
3636
Args:
3737
core_sync_tool: The underlying core sync ToolboxTool instance.
3838
"""
39+
40+
# Due to how pydantic works, we must initialize the underlying
41+
# BaseTool class before assigning values to member variables.
3942
super().__init__(
40-
name=self.__core_sync_tool.__name__,
41-
description=self.__core_sync_tool.__doc__,
42-
args_schema=self.__core_sync_tool._ToolboxSyncTool__async_tool._ToolboxTool__pydantic_model,
43+
name=core_sync_tool.__name__,
44+
description=core_sync_tool.__doc__,
45+
args_schema=core_sync_tool._ToolboxSyncTool__async_tool._ToolboxTool__pydantic_model,
4346
)
4447
self.__core_sync_tool = core_sync_tool
4548

0 commit comments

Comments
 (0)