Im trying to get functions working with the API. This is just a test and rough prototyping currently. It will do one function but not the other one, which is a simple requesting the current time. I get the below responses.
Generated response: As an AI, I’'‘m unable to provide real-time information such as the current time. Please check the device you’''re using for the most accurate time.
I know it dose not know the time but i thought the function would go above that. Any help would be good.
First Prompt
{
"model": "gpt-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "give me the current time"}
],
"temperature": 0.2,
"tools": [{
"type": "function",
"function": {
"name":"getCurrentTime",
"description": "this will get the time"
}
},{
"type": "function",
"function": {
"name":"getRandomWords",
"description": "this will get a list of predefined random words"
}
}
]
}
ChatGPT first reponds
{
"id": "chatcmpl-8aZ5ED4XAvDa7lYXq4OSBgz7oEa6f",
"object": "chat.completion",
"created": 1703725360,
"model": "gpt-4-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_PQJTIICE5PhM5NHMchhYiY68",
"type": "function",
"function": {
"name": "getCurrentTime",
"arguments": "{}"
}
}
]
},
"logprobs": null,
"finish_reason": "tool_calls"
}
],
"usage": {
"prompt_tokens": 68,
"completion_tokens": 7,
"total_tokens": 75
},
"system_fingerprint": null
}
Responds to command
{
"model": "gpt-4",
"temperature": 0.2,
"messages": [
{"role": "user", "content": "give me the current time"},
{"role": "function", "name": "getCurrentTime","content":"Current time: Thu 28 Dec 2023 12:02:41 AEDT" }
]
}
Final gpt reponds
{
"id": "chatcmpl-8aZ5FX1kpBFldviU3CvTTN2t7zV6V",
"object": "chat.completion",
"created": 1703725361,
"model": "gpt-4-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "As an AI, I'\''m unable to provide real-time information such as the current time. Please check the device you'\''re using for the most accurate time."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 36,
"completion_tokens": 31,
"total_tokens": 67
},
"system_fingerprint": null
}