文本响应
函数调用
函数调用的流程和对话接口类似,下面我们还是以获取当地天气为例,给出函数调用的示例代码:
Copy
curl --location --request POST 'https://geekai.co/api/v1/responses' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4o-mini",
"input": "杭州今天天气如何?",
"tools": [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. 浙江杭州"
},
"unit": {
"type": "string",
"enum": ["℃", "℉"]
}
},
"required": ["location", "unit"]
}
}
],
"tool_choice": "auto"
}'
助手
Responses are generated using AI and may contain mistakes.