Hello,
I am using an API request like the one below to categories sections of a document into predefined categories.
However, the model keeps adding categories that are not specified in the enum.
Is there anything I need to change in the request for the model to only use the enums? I have been adding and removing the strict key in different places without any luck.
I hope you help.
{
"model": "gpt-4o-mini-2024-07-18",
"messages": [
{
"role": "system",
"content": "Prompt Here"
},
{
"role": "user",
"content": "Document Here"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "categorize_document",
"response_format": "json",
"description": "Categorize sections of a document into predefined categories. Do not create new categories under any circumstances",
"strict": true,
"parameters": {
"type": "object",
"strict": true,
"properties": {
"text": {
"type": "string",
"description": "The exact text found in the document."
},
"category": {
"type": [
"string",
"null"
],
"enum": [
"World News",
"Politics",
"Business",
"Technology",
"Health",
"Science",
"Entertainment",
"Sports",
"Environment",
"Local News",
"Breaking News",
"Opinion",
"Editorial",
"Investigative Reporting",
"Weather",
"Travel",
"Lifestyle",
"Education",
"Culture"
],
"description": "The predefined categories used for categorization. Do not create new categories under any circumstances."
},
"reasoning": {
"type": "string",
"description": "The reasoning behind the categorization"
},
"pageNumber": {
"type": "string",
"description": "The page number the reference is found on"
}
},
"required": [
"text",
"category",
"reasoning",
"pageNumber"
],
"additionalProperties": false
}
}
}
]
}