{
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "What is the weather like in Shanghai?"
}
],
"tools": [
{
"type": "function",
"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. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
}
]
}
curl --location --request POST 'https://api.b3n.fun/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "What is the weather like in Shanghai?"
}
],
"tools": [
{
"type": "function",
"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. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
}
]
}'
{
"id": "chatcmpl-9CStt4UNFKSeNiVJSQ3jpak4AXjD1",
"object": "chat.completion",
"created": 1712758057,
"model": "gpt-4-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_fgyvip5QtML8ihGpozGKeccE",
"type": "function",
"function": {
"name": "get_current_weather",
"arguments": "{\n \"location\": \"Shanghai\"\n}"
}
}
]
},
"logprobs": null,
"finish_reason": "tool_calls"
}
],
"usage": {
"prompt_tokens": 82,
"completion_tokens": 17,
"total_tokens": 99
},
"system_fingerprint": null
}