Evalkeeper
    Preparing search index...

    Function decideAndPrice

    • Asks a decision model its questions about one state (the AI SDK's experimental_decide) and reports what the call cost, so a decision suite's run stays one call. Grade the answers with decisionCheck from evalkeeper.

      Type Parameters

      • const QUESTIONS extends Record<string, DecisionModelV4Question>

      Parameters

      • opts: {
            model: DecisionModel;
            modelId: string;
            models: ModelCatalog;
            onCost?: (usd: number) => void;
            providerOptions?: SharedV4ProviderOptions;
            questions: QUESTIONS;
            state: DecisionState;
        }
        • model: DecisionModel
        • modelId: string

          The model's id in your catalog, for its price.

        • models: ModelCatalog
        • OptionalonCost?: (usd: number) => void

          Gets the call's cost, when the catalog has a price.

        • OptionalproviderOptions?: SharedV4ProviderOptions

          Passed to the provider, e.g. a reasoning setting.

        • questions: QUESTIONS
        • state: DecisionState

      Returns Promise<DecisionResult<QUESTIONS>>

      const { answers } = await decideAndPrice({
      model: openai.decisionModel("gpt-6-luna"),
      modelId: "gpt-6-luna",
      models: MODELS,
      state: ticket.body,
      questions: {
      queue: { type: "choice", criteria: { billing: "Charges", bug: "Broken" } },
      urgent: { type: "boolean", instructions: "Can people not work?" },
      },
      onCost: ctx.onCost,
      });