# 返回值结果
# 首先大模型通过意图识别到需要调用 Tool Call,所以在 tool_calls 里给出了需要调用的函数名称,以及参数
{
"id": "291c59ebf4017a937a2a42a8ed52581f.c2669ebc05a491c70f821b4e568b6433",
"object": "chat.completion",
"created": 1722505763,
"model": "step-1-8k",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_brg23SRcTgmpm_V0jfP-iA",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\": \" 上海 \"}"
}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"cached_tokens": 48,
"prompt_tokens": 94,
"completion_tokens": 16,
"total_tokens": 110
}
}
# 接着使用大模型给出的参数调用查询天气接口,获得准确的天气
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"lives": [
{
"province": "上海",
"city": "上海市",
"adcode": "310000",
"weather": "晴",
"temperature": "37",
"winddirection": "西北",
"windpower": "≤3",
"humidity": "42",
"reporttime": "2024-08-02 10:01:14",
"temperature_float": "37.0",
"humidity_float": "42.0"
}
]
}
# 继续拼接作为上下文信息放入 Messages,让大模型进行补全。