Hey guys,
a question about functions.
There is a function signature and a response below.
Nothing fancy - I do some test with a news api.
The message is what I get back from the openai API
My prompt was “What’s new in politics?”
and I get a category “politics”
however in the function signature category is an enum - and politics is not part of that enum. I expected that gpt would cleverly map that to the closest fitting category ?
The way it is now it causes a problem because the api behind it does only except values that are in the enum.
What am I missing ?
MESSAGE: {
"content": null,
"function_call": {
"arguments": "{\n \"category\": \"politics\"\n}",
"name": "get_top_headlines_stories"
},
"role": "assistant"
}
top_headlines_signature = {
"name": "get_top_headlines_stories",
"description": "This function provides live top and breaking headlines for a country and specific category. Articles are sorted by the earliest date published first.",
"parameters": {
"type": "object",
"properties": {
"country": {
"type": "string",
"enum": ["de", "us", "ru", "gb", "fr", "it", "es"],
"description": "The Country of the news source. Possible options: de, us, ru, gb, fr, it, es"
},
"category": {
"type": "string",
#options: business entertainment general health science sports technology
"enum": ["business", "entertainment", "general", "health", "science", "sports", "technology"],
"description": "The Category of the news headline. Possible options: business, entertainment, general, health, science, sports, technology"
}
},
"required": ["category"]
}
}