MediaPipeTasksDecision Framework Reference

ChoiceQuestion

struct ChoiceQuestion: Sendable, Equatable

Configuration for evaluating a mutually exclusive categorical choice menu.

  • Declaration

    Swift

    init(choices: [String], descriptions: [String]? = nil, temperature: Float = 0.0, instructions: String = "", scoringMode: ScoringMode = .lengthNormalizedLogProb, normalizePrior: Bool = false)
  • Creates a ChoiceQuestion from an ordered list of (key, description) tuples.

    Declaration

    Swift

    init(options: [(key: String, description: String)], temperature: Float = 0.0, instructions: String = "", scoringMode: ScoringMode = .lengthNormalizedLogProb, normalizePrior: Bool = false)
  • Ordered list of option keys.

    Declaration

    Swift

    var choices: [String]
  • Optional descriptions corresponding 1:1 with choices.

    Declaration

    Swift

    var descriptions: [String]?
  • Optional task instructions prepended to the choice prompt.

    Declaration

    Swift

    var instructions: String
  • Whether to normalize option log-probabilities against the empty-context prior.

    Declaration

    Swift

    var normalizePrior: Bool
  • Multi-token log-probability aggregation strategy.

    Declaration

    Swift

    var scoringMode: ScoringMode
  • Softmax temperature override (0.0 uses the model's calibrated default).

    Declaration

    Swift

    var temperature: Float