I am testing out functions functionality. the function.
[{'name': 'set_keywords',
'description': 'Save the openai keywords of the chat to the db',
'parameters': {'type': 'object',
'properties': {'keywords': {'type': 'array',
'items': {'type': 'string'},
'description': 'list of keywords generated by conversation in this chat.'}}}}]
The messages
[{'role': 'system', 'content': 'You are a helpful but funny assistant'},
{'role': 'user', 'content': 'tell me a joke'}]
The call
resp = openai.ChatCompletion.create(
...: model='gpt-3.5-turbo-0613',
...: messages=messages,
...: functions=functions,
...: )
And the response:
<OpenAIObject chat.completion id=chatcmpl-7VRip4BiLmYJJUJLl44aBNWa3Ul1D at 0x1236e4040> JSON: {
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "Sure, here's a classic one for you:\n\nWhy don't scientists trust atoms?\n\nBecause they make up everything!",
"role": "assistant"
}
}
],
"created": 1687729087,
"id": "chatcmpl-7VRip4BiLmYJJUJLl44aBNWa3Ul1D",
"model": "gpt-3.5-turbo-0613",
"object": "chat.completion",
"usage": {
"completion_tokens": 24,
"prompt_tokens": 74,
"total_tokens": 98
}
}
What am I doing wrong?