toolCallingEnabled 根据 ENV + Tools 列表判定是否启用工具调用模拟。 默认启用(只要客户端传了 tools);设置 TOOL_CALLING_ENABLED=false 可强制关闭。
(tools []officialtypes.Tool)
| 2267 | // toolCallingEnabled 根据 ENV + Tools 列表判定是否启用工具调用模拟。 |
| 2268 | // 默认启用(只要客户端传了 tools);设置 TOOL_CALLING_ENABLED=false 可强制关闭。 |
| 2269 | func toolCallingEnabled(tools []officialtypes.Tool) bool { |
| 2270 | if env := strings.ToLower(strings.TrimSpace(os.Getenv("TOOL_CALLING_ENABLED"))); env == "false" || env == "0" || env == "no" { |
| 2271 | return false |
| 2272 | } |
| 2273 | return len(tools) > 0 |
| 2274 | } |
| 2275 | |
| 2276 | // handleToolCalling 工具调用模式的主流程: |
| 2277 | // 1. 把 OpenAI 请求转换并注入 <tool_call> 协议; |