Skip to content

Commit e8ec4f4

Browse files
committed
chore: Remove property exposing internal state from toolbox core tool
1 parent 993cf7e commit e8ec4f4

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

packages/toolbox-core/src/toolbox_core/tool.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ def _auth_service_token_getters(self) -> Mapping[str, Callable[[], str]]:
159159
def _client_headers(self) -> Mapping[str, Union[Callable, Coroutine, str]]:
160160
return MappingProxyType(self.__client_headers)
161161

162-
@property
163-
def _pydantic_model(self) -> type[BaseModel]:
164-
return self.__pydantic_model
165-
166162
def __copy(
167163
self,
168164
session: Optional[ClientSession] = None,

packages/toolbox-core/tests/test_tool.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -578,24 +578,6 @@ def test_toolbox_tool_underscore_client_headers_property(toolbox_tool: ToolboxTo
578578
client_headers["new_header"] = "new_value"
579579

580580

581-
def test_toolbox_tool_underscore_pydantic_model_property(toolbox_tool: ToolboxTool):
582-
"""Tests the _pydantic_model property returns the correct Pydantic model."""
583-
pydantic_model = toolbox_tool._pydantic_model
584-
assert issubclass(pydantic_model, BaseModel)
585-
assert pydantic_model.__name__ == TEST_TOOL_NAME
586-
587-
# Test that the model can validate expected data
588-
valid_data = {"message": "test", "count": 10}
589-
validated_data = pydantic_model.model_validate(valid_data)
590-
assert validated_data.message == "test"
591-
assert validated_data.count == 10
592-
593-
# Test that the model raises ValidationError for invalid data
594-
invalid_data = {"message": 123, "count": "not_an_int"}
595-
with pytest.raises(ValidationError):
596-
pydantic_model.model_validate(invalid_data)
597-
598-
599581
# --- Test for the HTTP Warning ---
600582
@pytest.mark.parametrize(
601583
"trigger_condition_params",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from langchain_core.tools import BaseTool
1818
from toolbox_core.tool import ToolboxTool as ToolboxCoreTool
19+
from toolbox_core.utils import params_to_pydantic_model
1920

2021

2122
# This class is an internal implementation detail and is not exposed to the
@@ -43,7 +44,7 @@ def __init__(
4344
super().__init__(
4445
name=core_tool.__name__,
4546
description=core_tool.__doc__,
46-
args_schema=core_tool._pydantic_model,
47+
args_schema=params_to_pydantic_model(core_tool._name, core_tool._params),
4748
)
4849
self.__core_tool = core_tool
4950

0 commit comments

Comments
 (0)