Skip to content

Commit a128a8e

Browse files
committed
fix: Use correct interfaces of toolbox-core
1 parent 7b13f20 commit a128a8e

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from asyncio import wrap_future
15+
from asyncio import to_thread
1616
from typing import Any, Callable, Optional, Union
1717
from warnings import warn
1818

@@ -85,12 +85,11 @@ async def aload_tool(
8585
)
8686
auth_token_getters = auth_headers
8787

88-
core_tool = await wrap_future(
89-
self.__core_client._load_tool_future(
90-
name=tool_name,
91-
auth_token_getters=auth_token_getters,
92-
bound_params=bound_params,
93-
)
88+
core_tool = await to_thread(
89+
self.__core_client.load_tool,
90+
name=tool_name,
91+
auth_token_getters=auth_token_getters,
92+
bound_params=bound_params,
9493
)
9594
return ToolboxTool(core_tool=core_tool)
9695

@@ -151,13 +150,12 @@ async def aload_toolset(
151150
)
152151
auth_token_getters = auth_headers
153152

154-
core_tools = await wrap_future(
155-
self.__core_client._load_toolset_future(
156-
name=toolset_name,
157-
auth_token_getters=auth_token_getters,
158-
bound_params=bound_params,
159-
strict=strict,
160-
)
153+
core_tools = await to_thread(
154+
self.__core_client.load_toolset,
155+
name=toolset_name,
156+
auth_token_getters=auth_token_getters,
157+
bound_params=bound_params,
158+
strict=strict,
161159
)
162160

163161
tools = []

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from asyncio import wrap_future
15+
from asyncio import to_thread
1616
from typing import Any, Callable, Union
1717

1818
from langchain_core.tools import BaseTool
@@ -50,7 +50,7 @@ def _run(self, **kwargs: Any) -> str:
5050
return self.__core_tool(**kwargs)
5151

5252
async def _arun(self, **kwargs: Any) -> str:
53-
return await wrap_future(self.__core_tool._call_future(**kwargs))
53+
return await to_thread(self.__core_tool, **kwargs)
5454

5555
def add_auth_token_getters(
5656
self, auth_token_getters: dict[str, Callable[[], str]]

0 commit comments

Comments
 (0)