llm
config_error
ai_generated
true
错误:并行函数调用需要不同的函数名称——检测到重复的'get_weather'
Error: Parallel function calls require distinct function names — duplicate 'get_weather' detected
ID: llm/parallel-function-call-schema-conflict
80%修复率
82%置信度
1证据数
2024-06-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| openai>=1.0.0 | active | — | — | — |
| gpt-4-0125-preview | active | — | — | — |
| gpt-4-turbo-2024-04-09 | active | — | — | — |
根因分析
使用并行函数调用时,LLM 可能尝试同时多次调用同一函数;API 会拒绝单个响应中 tool_calls 数组内的重复函数名称。
English
When using parallel function calling, the LLM may attempt to call the same function multiple times concurrently; the API rejects duplicate function names in a single response's tool_calls array.
官方文档
https://platform.openai.com/docs/guides/function-calling/parallel-function-calling解决方案
-
允许重复的函数名称:在 tools 中定义一次函数,并通过遍历 tool_calls 数组在应用逻辑中处理对同一函数的多次调用。
-
如果不需要并行调用,在请求中设置 parallel_tool_calls=false 以强制顺序函数调用。
-
实现去重层:在处理 tool_calls 之前,将具有相同名称的重复函数调用合并为具有合并参数的单个调用,或用清晰的错误消息拒绝重复。
无效尝试
常见但无效的做法:
-
90% 失败
Function names are defined in the tools array and must be static; dynamic renaming breaks schema consistency
-
50% 失败
Disabling parallel calls reduces throughput and may cause timeouts for workflows requiring multiple tool invocations
-
70% 失败
The LLM may consistently generate duplicate calls for certain inputs; retries are unreliable and waste tokens