In most cases, when I explicitly tell the model which tool to use, the model can accurately complete the call, but there are a few cases where the tool_resp request returned by the model is not processed by springAi and returned directly as the model, such as the following:
{"name": "生成数据", "arguments": {"planId": "0920163013", "userName": "234234", "creditDocInfo": "{\"creditType\":\"FSI\",\"creditDesc\":\"FDSGV分\",\"queryKey\":\"PHONE,ID_NO\",\"subSysNames\":\"CRE-SERVICE,CRE-BATCH\",\"reqType...
```json
What is the problem? Why is the tool call in the tag not actually understood and executed by SpringAi?
在大部分情况下,当我明确告诉了模型应该使用哪个工具,模型都能精准的完成调用,但是存在少部分情况模型返回的tool_resp请求没有被springAi处理,直接作为模型的返回了,例如下面这样:
{"name": "生成数据", "arguments": {"planId": "0920163013", "userName": "234234", "creditDocInfo": "{\"creditType\":\"FSI\",\"creditDesc\":\"FDSGV分\",\"queryKey\":\"PHONE,ID_NO\",\"subSysNames\":\"CRE-SERVICE,CRE-BATCH\",\"reqTypes\":\"SINGLE_ASYNC,BATCH\",\"interfaceId\":\"447172\",\"creditResult\":[{\"fieldName\":\"scoreid\",\"fieldFullName\":\"fsi.scoreid\",\"fieldDesc\":\"系统产生的唯一评分编号\",\"fieldType\":\"C(120)\"},{\"fieldName\":\"score\",\"fieldFullName\":\"fsi.score\",\"fieldDesc\":\"评分结果\",\"fieldType\":\"N(3)\"},{\"fieldName\":\"reason\",\"fieldFullName\":\"fsi.reason\",\"fieldDesc\":\"原因码\",\"fieldType\":\"C(20)\"}],\"releasePlanId\":\"105857\",\"releasePlanName\":\"【2025.11.18-2099.11.20】发布计划1118\",\"storyId\":\"196862\",\"version\":\"2025.11.18\",\"branchNo\":\"25.11.18\",\"sysStoryInfos\":[{\"storyId\":202210,\"storyName\":\"test数据源接入需求-CDPS-CSERVICE\",\"subSystemId\":\"6307\",\"subSystemName\":\"CDPS-CSERVICE\"},{\"storyId\":202222,\"storyName\":\"test数据源接入需求-CRE-SERVICE\",\"subSystemId\":\"6048\",\"subSystemName\":\"CRE-SERVICE\"},{\"storyId\":202223,\"storyName\":\"test数据源接入需求-DVS-RISKADSDWH\",\"subSystemId\":\"6166\",\"subSystemName\":\"CNCBDP-RISKADSDWH\"}],\"attachInfos\":[{\"fileName\":\"GDGGB源需求文档.docx\",\"fileUrl\":\"http://uat.233.234.com/proxy/get_file/1c343sdf48869a7b09e4a5259426.docx\"},{\"fileName\":\"接口文档.xlsx\",\"fileUrl\":\"http://uat.dfg.sdffd.com/proxy/get_file/076sdf486c3b12037df8593.xlsx\"}]}"}}}
请问这是什么问题?为什么这个标签的工具调用没有真正被SpringAi理解和执行?
Comment From: bchengwang
What model are you using? Spring AI now handles function calls by leveraging the model's native Function Calling capability, rather than triggering function execution by parsing specific tags.
Comment From: luxdong
I also encountered the same problem. The chatclient directly returned:
{"name": "listItemPackages", "arguments": {}}
But sometimes it can call tools normally, and the model is qwen3