17
17
18
18
import pytest
19
19
import pytest_asyncio
20
+ from llama_index .core .tools .types import ToolOutput
20
21
from pydantic import ValidationError
21
22
from toolbox_core .protocol import ParameterSchema as CoreParameterSchema
22
23
from toolbox_core .tool import ToolboxTool as ToolboxCoreTool
@@ -261,7 +262,14 @@ async def test_toolbox_tool_call_requires_auth_strict(self, auth_toolbox_tool):
261
262
262
263
async def test_toolbox_tool_call (self , toolbox_tool ):
263
264
result = await toolbox_tool .acall (param1 = "test-value" , param2 = 123 )
264
- assert result == "test-result"
265
+ assert result == ToolOutput (
266
+ content = "test-result" ,
267
+ tool_name = "test_tool" ,
268
+ raw_input = {"param1" : "test-value" , "param2" : 123 },
269
+ raw_output = "test-result" ,
270
+ is_error = False ,
271
+ )
272
+
265
273
core_tool = toolbox_tool ._AsyncToolboxTool__core_tool
266
274
core_tool ._ToolboxTool__session .post .assert_called_once_with (
267
275
"http://test_url/api/tool/test_tool/invoke" ,
@@ -281,7 +289,13 @@ async def test_toolbox_tool_call_with_bound_params(
281
289
):
282
290
tool = toolbox_tool .bind_params (bound_param_map )
283
291
result = await tool .acall (param2 = 123 )
284
- assert result == "test-result"
292
+ assert result == ToolOutput (
293
+ content = "test-result" ,
294
+ tool_name = "test_tool" ,
295
+ raw_input = {"param2" : 123 },
296
+ raw_output = "test-result" ,
297
+ is_error = False ,
298
+ )
285
299
core_tool = tool ._AsyncToolboxTool__core_tool
286
300
core_tool ._ToolboxTool__session .post .assert_called_once_with (
287
301
"http://test_url/api/tool/test_tool/invoke" ,
@@ -294,7 +308,14 @@ async def test_toolbox_tool_call_with_auth_tokens(self, auth_toolbox_tool):
294
308
{"test-auth-source" : lambda : "test-token" }
295
309
)
296
310
result = await tool .acall (param2 = 123 )
297
- assert result == "test-result"
311
+ assert result == ToolOutput (
312
+ content = "test-result" ,
313
+ tool_name = "test_tool" ,
314
+ raw_input = {"param2" : 123 },
315
+ raw_output = "test-result" ,
316
+ is_error = False ,
317
+ )
318
+
298
319
core_tool = tool ._AsyncToolboxTool__core_tool
299
320
core_tool ._ToolboxTool__session .post .assert_called_once_with (
300
321
"https://test-url/api/tool/test_tool/invoke" ,
@@ -325,7 +346,13 @@ async def test_toolbox_tool_call_with_auth_tokens_insecure(
325
346
{"test-auth-source" : lambda : "test-token" }
326
347
)
327
348
result = await tool_with_getter .acall (param2 = 123 )
328
- assert result == "test-result"
349
+ assert result == ToolOutput (
350
+ content = "test-result" ,
351
+ tool_name = "test_tool" ,
352
+ raw_input = {"param2" : 123 },
353
+ raw_output = "test-result" ,
354
+ is_error = False ,
355
+ )
329
356
330
357
modified_core_tool_in_new_tool = tool_with_getter ._AsyncToolboxTool__core_tool
331
358
assert (
0 commit comments