文章目錄
- MCP tools 調用
- 結果輸出
- MCP Tool 內容
- 成功返回
- 失敗返回
普通工具調用
https://blog.csdn.net/2401_89025022/article/details/148629902
MCP tools 調用
import time
import asyncio
import json
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from langchain_mcp_adapters.client import MultiServerMCPClientbase_url = 'https://ark.cn-beijing.volces.com/api/v3'
model = "ep-20250304190324-vpgqc"
api_key = 'ec8607...0d6bec80e' llm = ChatOpenAI(model=model, base_url=base_url, api_key=api_key, temperature=0.1) def create_agent(agent_name: str, tools: list, prompt: str):"""Factory function to create agents with consistent configuration."""return create_react_agent(name=agent_name, model=llm, tools=tools, prompt=prompt )async def create_agent_with_tool(): mcp_servers = { 'amap-amap-sse': {'transport': 'sse', 'url': 'https://mcp.amap.com/sse?key=1d01eb1e...020d600da'}}loaded_tools = []tool_names = []client = MultiServerMCPClient(mcp_servers) print('-- mcp client', client) tools = await client.get_tools() for tool in tools: print('\n-- tool name : ', tool.name) print(tool.description) loaded_tools.append(tool) tool_names.append(tool.name )# print('-- loaded_tools : ', loaded_tools, len(loaded_tools) ) print('-- loaded_tools : ', len(loaded_tools), ', '.join(tool_names) ) print('\n\n')#print(loaded_tools)#print('\n\n')#print(loaded_tools[1]) # print(vars(tool)) agent = create_agent(agent_name='test1', tools=loaded_tools, prompt='' ) t0 = time.time()q = '請幫我規劃 深圳西麗到石廈的騎行路線' # q = '深圳石廈地鐵站的經緯度坐標是多少?'resp2 = agent.invoke({"messages": [{"role": "user", "content": q }]})print('\n\n') # print(resp2 ) # print('\n', json.dumps(resp2, ensure_ascii=False, indent=4)) # print('-- cost : ', time.time() - t0 ) if __name__ == '__main__':asyncio.run(create_agent_with_tool())
結果輸出
MCP Tool 內容
[StructuredTool(name = 'maps_direction_bicycling', description = '騎行路徑規劃用于規劃騎行通勤方案,規劃時會考慮天橋、單行線、封路等情況。最大支持 500km 的騎行路線規劃', args_schema = {'type': 'object', 'required': ['origin', 'destination'],'properties': {'origin': {'type': 'string','description': '出發點經緯度,坐標格式為:經度,緯度'},'destination': {'type': 'string','description': '目的地經緯度,坐標格式為:經度,緯度'}}}, response_format = 'content_and_artifact',coroutine = < function convert_mcp_tool_to_langchain_tool. < locals > .call_tool at 0x110d5cfe0 > ),...
]
成功返回
{'messages': [HumanMessage( // 1content = '請幫我規劃 深圳西麗到石廈的騎行路線',additional_kwargs = {},response_metadata = {},id = '1efec420-47f9-4a0a-8d4a-e47eb905024d'),AIMessage( // 2name = 'test1',id = 'run--ef361011-bd51-4717-9d71-8628d7654f6a-0',content = '',additional_kwargs = {'tool_calls': [{'id': 'call_z2062i697h3tv5bjn6ol66zf','function': {'arguments': ' {"address": "深圳西麗", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = { 'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498713874923dc958bd234ae18541b7d6d3762c899f8ee541','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None,'token_usage': {'completion_tokens': 33,'prompt_tokens': 1683,'total_tokens': 1716,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},},tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_z2062i697h3tv5bjn6ol66zf','type': 'tool_call'}],usage_metadata = {'input_tokens': 1683,'output_tokens': 33,'total_tokens': 1716,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 3content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '115db843-1871-4dc0-be8e-2ff3aee90b0f',tool_call_id = 'call_z2062i697h3tv5bjn6ol66zf',status = 'error'),AIMessage(content = '',additional_kwargs = {'tool_calls': [{'id': 'call_qp5ygrgzgyt2e89zwrlv9cjz','function': {'arguments': ' {\n "address": "深圳西麗", \n "city": "深圳"\n }','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 47,'prompt_tokens': 1761,'total_tokens': 1808,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498713888753dc958bd234ae18541b7d6d3762c899fd997f5','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--fed37332-8e66-4d4f-ac53-b0f497f47042-0',tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_qp5ygrgzgyt2e89zwrlv9cjz','type': 'tool_call'}],usage_metadata = {'input_tokens': 1761,'output_tokens': 47,'total_tokens': 1808,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 4content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '693fe120-0eec-4935-bb8c-924a567adb29',tool_call_id = 'call_qp5ygrgzgyt2e89zwrlv9cjz',status = 'error'),AIMessage(content = '',additional_kwargs = {'tool_calls': [{'id': 'call_es029zxcwliwliegsojeemrw','function': {'arguments': ' {\n "address": "深圳西麗", \n "city": "深圳"\n }','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 50,'prompt_tokens': 1839,'total_tokens': 1889,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498713924413dc958bd234ae18541b7d6d3762c899fdb95d0','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--306aade0-58e7-416a-bb08-c4b1f6bd1dfb-0',tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_es029zxcwliwliegsojeemrw','type': 'tool_call'}],usage_metadata = {'input_tokens': 1839,'output_tokens': 50,'total_tokens': 1889,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 5content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '8f9de025-20cf-4913-ada8-5a1ea836f91c',tool_call_id = 'call_es029zxcwliwliegsojeemrw',status = 'error'),AIMessage(content = '',additional_kwargs = {'tool_calls': [{'id': 'call_6iw2766xj1zybxz7sahxpkox','function': {'arguments': ' {\n "address": "深圳西麗", \n "city": "深圳"\n }','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 50,'prompt_tokens': 1917,'total_tokens': 1967,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498713948953dc958bd234ae18541b7d6d3762c899f839b10','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--0dd6a935-29c3-43fa-9c2d-d0ff78e57a1d-0',tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_6iw2766xj1zybxz7sahxpkox','type': 'tool_call'}],usage_metadata = {'input_tokens': 1917,'output_tokens': 50,'total_tokens': 1967,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 6content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '30a71f82-e6d1-4d8f-80c2-b4284d1234bd',tool_call_id = 'call_6iw2766xj1zybxz7sahxpkox',status = 'error'),AIMessage(content = '',additional_kwargs = {'tool_calls': [{'id': 'call_dum8xqpr869ogf9qoyxqaiy5','function': {'arguments': ' {"address": "深圳西麗", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 33,'prompt_tokens': 1995,'total_tokens': 2028,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498713975123dc958bd234ae18541b7d6d3762c899f5b1dad','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--e37f3f82-8fbf-4a5e-9c4a-097e0083f9fa-0',tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_dum8xqpr869ogf9qoyxqaiy5','type': 'tool_call'}],usage_metadata = {'input_tokens': 1995,'output_tokens': 33,'total_tokens': 2028,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 7content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '75a39bda-1cfa-42f3-9b9f-ddde1dbaf51b',tool_call_id = 'call_dum8xqpr869ogf9qoyxqaiy5',status = 'error'),AIMessage(content = '',additional_kwargs = {'tool_calls': [{'id': 'call_64xccrpjh2gyezwsidsfx65l','function': {'arguments': ' {"address": "深圳西麗", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 33,'prompt_tokens': 2073,'total_tokens': 2106,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498713992753dc958bd234ae18541b7d6d3762c899f1f63cd','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--10d44363-46aa-4239-ae58-48963459e9a7-0',tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_64xccrpjh2gyezwsidsfx65l','type': 'tool_call'}],usage_metadata = {'input_tokens': 2073,'output_tokens': 33,'total_tokens': 2106,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 8content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = 'e89bd532-79e5-4ee8-ad5b-30292ffcc591',tool_call_id = 'call_64xccrpjh2gyezwsidsfx65l',status = 'error'),AIMessage(content = '為了規劃從深圳西麗到石廈的騎行路線,我將先把這兩個地點轉換為經緯度,然后進行騎行路徑規劃。\n',additional_kwargs = {'tool_calls': [{'id': 'call_7dknl1cxy93vckagzxvgcyh3','function': {'arguments': ' {"address": "深圳西麗", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 66,'prompt_tokens': 2151,'total_tokens': 2217,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498714015093dc958bd234ae18541b7d6d3762c899f6fc981','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--acc8772a-f244-4e38-8a2d-85bd366d04de-0',tool_calls = [{'name': 'maps_geo','args': {'address': '深圳西麗','city': '深圳'},'id': 'call_7dknl1cxy93vckagzxvgcyh3','type': 'tool_call'}],usage_metadata = {'input_tokens': 2151,'output_tokens': 66,'total_tokens': 2217,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 9 content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '55c5e117-957c-4526-95ba-1d2f2ea61cfd',tool_call_id = 'call_7dknl1cxy93vckagzxvgcyh3',status = 'error'),AIMessage(content = '由于當前環境無法直接調用工具獲取結果,我將為你梳理后續的調用步驟。\n\n在成功獲取到深圳西麗的經緯度后,接下來需要獲取石廈的經緯度,調用如下:\n',additional_kwargs = {'tool_calls': [{'id': 'call_5oq6qi1g26okge2z6l1gco4k','function': {'arguments': ' {"address": "石廈", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 80,'prompt_tokens': 2262,'total_tokens': 2342,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498714048983dc958bd234ae18541b7d6d3762c899fa59842','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--5286f66b-cd67-44a2-ac3a-0e712b26796f-0',tool_calls = [{'name': 'maps_geo','args': {'address': '石廈','city': '深圳'},'id': 'call_5oq6qi1g26okge2z6l1gco4k','type': 'tool_call'}],usage_metadata = {'input_tokens': 2262,'output_tokens': 80,'total_tokens': 2342,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 10content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_geo',id = '689761bb-629d-4cfe-a9ef-8a1def4feed4',tool_call_id = 'call_5oq6qi1g26okge2z6l1gco4k',status = 'error'),AIMessage(content = '在實際可調用工具的環境中,當獲取到深圳西麗和石廈的經緯度后,就可以進行騎行路徑規劃,調用如下:\n',additional_kwargs = {'tool_calls': [{'id': 'call_ih1qmot0qisrd3a9fa1j4uwc','function': {'arguments': ' {\n"origin": "深圳西麗的經緯度", \n"destination": "石廈的經緯度"\n}','name': 'maps_direction_bicycling'},'type': 'function'}],'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 89,'prompt_tokens': 2385,'total_tokens': 2474,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498714109043dc958bd234ae18541b7d6d3762c899fff09d4','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None},name = 'test1',id = 'run--b9c49765-e14b-4796-a757-44f17d860732-0',tool_calls = [{'name': 'maps_direction_bicycling','args': {'origin': '深圳西麗的經緯度','destination': '石廈的經緯度'},'id': 'call_ih1qmot0qisrd3a9fa1j4uwc','type': 'tool_call'}],usage_metadata = {'input_tokens': 2385,'output_tokens': 89,'total_tokens': 2474,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}),ToolMessage( // 11content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.",name = 'maps_direction_bicycling',id = 'dbe681da-86f9-463d-b863-94e02cde0de0',tool_call_id = 'call_ih1qmot0qisrd3a9fa1j4uwc',status = 'error'),AIMessage(content = '由于當前環境無法完成工具調用獲取實際結果,我可以為你總結整個解決問題的流程。\n\n要規劃從深圳西麗到石廈的騎行路線,需要按以下步驟進行:\n1. 調用 `maps_geo` 函數,將深圳西麗的地址轉換為經緯度。\n2. 再次調用 `maps_geo` 函數,將石廈的地址轉換為經緯度。\n3. 利用前兩步得到的經緯度,調用 `maps_direction_bicycling` 函數,規劃從深圳西麗到石廈的騎行路線。\n\n若你在可調用工具的環境中,可按照上述步驟依次執行函數調用,以獲取具體的騎行路線規劃結果。 ',additional_kwargs = {'refusal': None},response_metadata = {'token_usage': {'completion_tokens': 156,'prompt_tokens': 2507,'total_tokens': 2663,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '0217498714147643dc958bd234ae18541b7d6d3762c899ff2e8e0','service_tier': 'default','finish_reason': 'stop','logprobs': None},name = 'test1',id = 'run--e8968379-e79c-4953-837d-b22fe9fa7f46-0',usage_metadata = {'input_tokens': 2507,'output_tokens': 156,'total_tokens': 2663,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}})]
}
失敗返回
{'messages': [HumanMessage(content = '深圳石廈地鐵站的經緯度坐標是多少?', additional_kwargs = {}, response_metadata = {}, id = '4791605e-bd78-43ce-ba93-9806438dbdd3'), AIMessage(content = '用戶想了解深圳石廈地鐵站的經緯度坐標,調用 maps_geo 函數進行查詢。', additional_kwargs = {'tool_calls': [{'id': 'call_jrtanpsy2j6y0hlivsgzthaj','function': {'arguments': ' {"address": "石廈地鐵站", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None}, response_metadata = {'token_usage': {'completion_tokens': 68,'prompt_tokens': 1680,'total_tokens': 1748,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '02174987131023513c1297d0103bfea1a1f39a5b3e19ce3d451dc','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None}, name = 'test1', id = 'run--7297ce9f-4cf4-4f3c-85db-111481cb165e-0', tool_calls = [{'name': 'maps_geo','args': {'address': '石廈地鐵站','city': '深圳'},'id': 'call_jrtanpsy2j6y0hlivsgzthaj','type': 'tool_call'}], usage_metadata = {'input_tokens': 1680,'output_tokens': 68,'total_tokens': 1748,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}), ToolMessage(content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.", name = 'maps_geo', id = '9d694d13-3758-47be-a3be-6d2a8f8ec1fe', tool_call_id = 'call_jrtanpsy2j6y0hlivsgzthaj', status = 'error'), AIMessage(content = '很抱歉,在調用工具時出現了錯誤。不過,我們可以重新嘗試調用 `maps_geo` 函數來獲取深圳石廈地鐵站的經緯度坐標。\n', additional_kwargs = {'tool_calls': [{'id': 'call_3o657fvw02l7jqjetbglnu7j','function': {'arguments': ' {"address": "石廈地鐵站", "city": "深圳"}','name': 'maps_geo'},'type': 'function'}],'refusal': None}, response_metadata = {'token_usage': {'completion_tokens': 72,'prompt_tokens': 1779,'total_tokens': 1851,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '02174987131309413c1297d0103bfea1a1f39a5b3e19ce3fb06ca','service_tier': 'default','finish_reason': 'tool_calls','logprobs': None}, name = 'test1', id = 'run--dba5aec5-950a-45c7-8139-d3c71348d970-0', tool_calls = [{'name': 'maps_geo','args': {'address': '石廈地鐵站','city': '深圳'},'id': 'call_3o657fvw02l7jqjetbglnu7j','type': 'tool_call'}], usage_metadata = {'input_tokens': 1779,'output_tokens': 72,'total_tokens': 1851,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}}), ToolMessage(content = "Error: NotImplementedError('StructuredTool does not support sync invocation.')\n Please fix your mistakes.", name = 'maps_geo', id = '15dbc135-cbb1-4aeb-9b4e-e10627ad1701', tool_call_id = 'call_3o657fvw02l7jqjetbglnu7j', status = 'error'), AIMessage(content = "目前調用工具時持續出現 `NotImplementedError('StructuredTool does not support sync invocation.')` 錯誤,這可能是工具本身的同步調用不被支持導致的。由于無法正常調用工具獲取數據,暫時無法為你查詢到深圳石廈地鐵站的經緯度坐標。你可以檢查工具的使用說明,看是否需要調整調用方式,或者嘗試在其他平臺手動查詢該地鐵站的經緯度信息。 ", additional_kwargs = {'refusal': None}, response_metadata = {'token_usage': {'completion_tokens': 92,'prompt_tokens': 1894,'total_tokens': 1986,'completion_tokens_details': {'accepted_prediction_tokens': None,'audio_tokens': None,'reasoning_tokens': 0,'rejected_prediction_tokens': None},'prompt_tokens_details': {'audio_tokens': None,'cached_tokens': 0}},'model_name': 'doubao-1-5-pro-32k-250115','system_fingerprint': None,'id': '02174987131668313c1297d0103bfea1a1f39a5b3e19ce32c8612','service_tier': 'default','finish_reason': 'stop','logprobs': None}, name = 'test1', id = 'run--f53c4141-a77d-432a-9db4-ccc7ead29daf-0', usage_metadata = {'input_tokens': 1894,'output_tokens': 92,'total_tokens': 1986,'input_token_details': {'cache_read': 0},'output_token_details': {'reasoning': 0}})]
}