文档 / API 参考
Function Calling
工具定义、并行调用与结果回填全部透传,无需改写。
JSON
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
}]调用流程
- 模型返回 tool_calls,finish_reason 为 tool_calls。
- 你在本地执行函数,把结果作为 role 为 tool 的消息追加回去。
- 再次请求,模型基于工具结果给出最终回复。
并非所有模型都支持并行工具调用,模型详情页的能力标签里会标明。