I’m using the gpt-3.5-turbo api to generate synonyms based on user input.
I need 10 synonyms per word, and so I’m instructing the model: both by simply stating give me 10 synonyms, and by requiring this amount using the minItems-maxItems property of json schema.
It’s not working. At best, it’s giving 3.
Bear in mind that before, when I used only structured text (told it to return 10 synonyms seperated by tildes [~]) and not function calling, it worked fine. Sometimes it flopped (which is why I’m moving to functions), but generally fine. Now it just seems to ignore my strict instructions, which is puzzling since I literally specified amount “by the book” using json…
I must stress that everything besides works charm. I’m getting exactly the parameters I want, just not the amount needed.
Anybody knows how to make the api listen to me, and return as many objects as I want?
Here’s the code (ignore syntax oddities; I’m using a php wrapper so it looks a bit weird but it’s working):
'functions' => [
[
"name" => "get_synonyms",
"parameters" => [
"type" => "object",
"properties" => [
"original_word" => [
"type" => "string",
],
"synonyms" => [
"type" => "array",
"items" => [
"type" => "object",
"properties" => [
"synonym" => [
"type" => "string",
],
"synonym_popularity" => [
"type" => "string",
],
"synonym_style" => [
"type" => "string",
"description" => "is it slang, or formal, or in between?",
],
],
],
"description" => "10 synonyms.",
"minItems" => 10,
"maxItems" => 10,
],
],
],
],
],