MediaPipeTasksDecision Framework Reference

DecisionMaker

final class DecisionMaker

MediaPipe Decision Task API for iOS / macOS in Swift.

Evaluates structured decision questions (BooleanQuestion, ChoiceQuestion, ScoreQuestion, and multi-question JSON schemas) against input text in a single forward pass, returning calibrated probabilities, expected rubric scores, and confidence metrics.

  • Convenience initializer that creates a DecisionMaker instance from a local model file path.

    Declaration

    Swift

    convenience init(modelPath: String) throws
  • Initializes a new DecisionMaker instance with the given DecisionMakerOptions.

    Declaration

    Swift

    init(options: DecisionMakerOptions) throws
  • Releases the underlying native engine resources.

    Declaration

    Swift

    final func close()
  • Evaluates a BooleanQuestion against text and returns a calibrated BooleanResult.

    Declaration

    Swift

    final func evaluate(text: String, question: BooleanQuestion) throws -> BooleanResult
  • Evaluates a ChoiceQuestion against text and returns a calibrated ChoiceResult.

    Declaration

    Swift

    final func evaluate(text: String, question: ChoiceQuestion) throws -> ChoiceResult
  • Evaluates a ScoreQuestion against text and returns a calibrated ScoreResult.

    Declaration

    Swift

    final func evaluate(text: String, question: ScoreQuestion) throws -> ScoreResult
  • Evaluates a BooleanQuestion against a batch of texts (with an optional sharedPrefixText).

    Declaration

    Swift

    final func evaluateBatch(texts: [String], question: BooleanQuestion, sharedPrefixText: String? = nil) throws -> [BooleanResult]
  • Evaluates a JSON request containing input text (text, context, or state) and a multi-question schema (questions or OpenAI properties) and returns a JSON-serialized DecisionResult.

    Declaration

    Swift

    final func evaluateJson(_ jsonRequest: String) throws -> String
  • Prewarms the prompt prefix and option KV/embedding cache for a ChoiceQuestion.

    Declaration

    Swift

    final func prewarm(question: ChoiceQuestion) throws
  • Prewarms and caches a JSON question schema into the backend's KV/option cache.

    Declaration

    Swift

    final func prewarmJson(_ jsonSchema: String) throws