Answer several classification questions about one prompt in a single
request, returning one outcome per criterion in the order given.
With a language model, every criterion is a required property of one
generateObject schema, keyed by its name, whose label is constrained to
the criterion's labels; each answer carries an explanation. With an AI SDK
decision model, every criterion is a choice question in one
experimental_decide call, and answers carry label probabilities instead of
an explanation.
A criterion that can't be classified becomes a failed outcome without
discarding the other criteria: a provider that doesn't enforce the schema
may answer one criterion with an unknown label or omit it, and a decision
model may refuse one question.
constoutcomes = awaitgenerateClassifications({ model:openai("gpt-6-luna"), prompt:"Review: the product broke after a day.", criteria: [ { name:"sentiment", instruction:"What is the sentiment of the review?", labels: { positive:null, negative:null }, }, ], });
Answer several classification questions about one prompt in a single request, returning one outcome per criterion in the order given.
With a language model, every criterion is a required property of one
generateObjectschema, keyed by its name, whose label is constrained to the criterion's labels; each answer carries an explanation. With an AI SDK decision model, every criterion is a choice question in oneexperimental_decidecall, and answers carry label probabilities instead of an explanation.A criterion that can't be classified becomes a
failedoutcome without discarding the other criteria: a provider that doesn't enforce the schema may answer one criterion with an unknown label or omit it, and a decision model may refuse one question.