@@ -1167,14 +1167,12 @@ async def stream_function(
11671167 yield {
11681168 1 : BuiltinToolReturnPart (
11691169 tool_name = WebSearchTool .kind ,
1170- content = {
1171- 'results' : [
1172- {
1173- 'title' : '"Hello, World!" program' ,
1174- 'url' : 'https://en.wikipedia.org/wiki/%22Hello,_World!%22_program' ,
1175- }
1176- ]
1177- },
1170+ content = [
1171+ {
1172+ 'title' : '"Hello, World!" program' ,
1173+ 'url' : 'https://en.wikipedia.org/wiki/%22Hello,_World!%22_program' ,
1174+ }
1175+ ],
11781176 tool_call_id = 'search_1' ,
11791177 provider_name = 'function' ,
11801178 )
@@ -1210,21 +1208,19 @@ async def stream_function(
12101208 'type' : 'tool-input-available' ,
12111209 'toolCallId' : 'search_1' ,
12121210 'toolName' : 'web_search' ,
1213- 'input' : '{" query":" Hello world"}' ,
1211+ 'input' : { ' query' : ' Hello world' } ,
12141212 'providerExecuted' : True ,
12151213 'providerMetadata' : {'pydantic_ai' : {'provider_name' : 'function' }},
12161214 },
12171215 {
12181216 'type' : 'tool-output-available' ,
12191217 'toolCallId' : 'search_1' ,
1220- 'output' : {
1221- 'results' : [
1222- {
1223- 'title' : '"Hello, World!" program' ,
1224- 'url' : 'https://en.wikipedia.org/wiki/%22Hello,_World!%22_program' ,
1225- }
1226- ]
1227- },
1218+ 'output' : [
1219+ {
1220+ 'title' : '"Hello, World!" program' ,
1221+ 'url' : 'https://en.wikipedia.org/wiki/%22Hello,_World!%22_program' ,
1222+ }
1223+ ],
12281224 'providerExecuted' : True ,
12291225 },
12301226 {'type' : 'text-start' , 'id' : IsStr ()},
@@ -1302,7 +1298,7 @@ async def web_search(query: str) -> dict[str, list[dict[str, str]]]:
13021298 'type' : 'tool-input-available' ,
13031299 'toolCallId' : 'search_1' ,
13041300 'toolName' : 'web_search' ,
1305- 'input' : '{" query":" Hello world"}' ,
1301+ 'input' : { ' query' : ' Hello world' } ,
13061302 },
13071303 {
13081304 'type' : 'tool-output-available' ,
@@ -1421,9 +1417,13 @@ def web_search(query: str) -> dict[str, list[dict[str, str]]]:
14211417 'type' : 'tool-input-available' ,
14221418 'toolCallId' : 'search_1' ,
14231419 'toolName' : 'final_result' ,
1424- 'input' : '{"query":"Hello world"}' ,
1420+ 'input' : {'query' : 'Hello world' },
1421+ },
1422+ {
1423+ 'type' : 'tool-output-available' ,
1424+ 'toolCallId' : 'search_1' ,
1425+ 'output' : 'Final result processed.' ,
14251426 },
1426- {'type' : 'tool-output-available' , 'toolCallId' : 'search_1' , 'output' : 'Final result processed.' },
14271427 {'type' : 'finish-step' },
14281428 {'type' : 'finish' },
14291429 '[DONE]' ,
@@ -1468,11 +1468,7 @@ async def stream_function(
14681468 'toolCallId' : IsStr (),
14691469 'toolName' : 'unknown_tool' ,
14701470 },
1471- {
1472- 'type' : 'tool-input-available' ,
1473- 'toolCallId' : IsStr (),
1474- 'toolName' : 'unknown_tool' ,
1475- },
1471+ {'type' : 'tool-input-available' , 'toolCallId' : IsStr (), 'toolName' : 'unknown_tool' , 'input' : {}},
14761472 {
14771473 'type' : 'tool-output-error' ,
14781474 'toolCallId' : IsStr (),
@@ -1489,11 +1485,7 @@ async def stream_function(
14891485 'toolCallId' : IsStr (),
14901486 'toolName' : 'unknown_tool' ,
14911487 },
1492- {
1493- 'type' : 'tool-input-available' ,
1494- 'toolCallId' : IsStr (),
1495- 'toolName' : 'unknown_tool' ,
1496- },
1488+ {'type' : 'tool-input-available' , 'toolCallId' : IsStr (), 'toolName' : 'unknown_tool' , 'input' : {}},
14971489 {'type' : 'error' , 'errorText' : 'Exceeded maximum retries (1) for output validation' },
14981490 {'type' : 'finish-step' },
14991491 {'type' : 'finish' },
@@ -1832,7 +1824,7 @@ async def test_adapter_load_messages():
18321824 UserPromptPart (
18331825 content = [
18341826 'Here are some files:' ,
1835- BinaryImage (data = b'fake' , media_type = 'image/png' ),
1827+ BinaryImage (data = b'fake' , media_type = 'image/png' , _identifier = 'c053ec' ),
18361828 ImageUrl (url = 'https://example.com/image.png' , _media_type = 'image/png' ),
18371829 VideoUrl (url = 'https://example.com/video.mp4' , _media_type = 'video/mp4' ),
18381830 AudioUrl (url = 'https://example.com/audio.mp3' , _media_type = 'audio/mpeg' ),
@@ -1846,7 +1838,7 @@ async def test_adapter_load_messages():
18461838 parts = [
18471839 ThinkingPart (content = 'I should tell the user how nice those files are and share another one' ),
18481840 TextPart (content = 'Nice files, here is another one:' ),
1849- FilePart (content = BinaryImage (data = b'fake' , media_type = 'image/png' )),
1841+ FilePart (content = BinaryImage (data = b'fake' , media_type = 'image/png' , _identifier = 'c053ec' )),
18501842 ],
18511843 timestamp = IsDatetime (),
18521844 ),
0 commit comments