evals
evals copied to clipboard
Functions: Support for minItems and maxItems for json schema array
Describe the feature or improvement you're requesting
First off - let me just say how great functions are! Game changer!
It would be really cool if the functions would respect validation like minItems
and maxItems
for an array.
If I explicitly put the number of questions I want in the function description it works, but I half expected it to work when setting minItems
. Unfortunately, if I specify minItems: 10
it only returns 5 questions.
I'd imagine other json schema validation options are ignored, and this could be a more generic ticket.
const func = {
name: "generateQuiz",
description: "Generate a questions about a given topic",
parameters: {
type: "object",
properties: {
topics: {
type: "array",
items: {
type: "string",
description: "Topic of the lesson, e.g. Planes",
},
},
questions: {
type: "array",
minItems: 10,
maxItems: 20,
description:
"Questions, e.g. What is the primary function of an airplane?",
items: {
type: "object",
properties: {
question: {
type: "string",
description:
"Question, e.g. What is the primary function of an airplane?",
},
answer: {
type: "string",
description: "Answer for the question",
},
},
required: ["question", "answer"],
},
},
},
required: ["topic", "questions"],
},
};
Additional context
No response