Arize Phoenix TS
    Preparing search index...
    • 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.

      Parameters

      Returns Promise<ClassificationOutcome[]>

      const outcomes = await generateClassifications({
      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 },
      },
      ],
      });