mediapipe_decision library

Google's MediaPipe Decision Maker: yes-or-no, choice and score questions about a text, answered with calibrated probabilities on Android, iOS, macOS, Linux, Windows and the web.

DecisionMaker has static create(options), Google's verbs (evaluateBoolean, evaluateChoice, evaluateScore and their batch forms), a delegate getter and dispose(). What a platform's runtime cannot do throws RuntimeUnavailableException, and queryDecisionMakerCapabilities() reports it in advance.

Classes

BooleanQuestion
A yes-or-no condition to check against a text: "The customer wants a refund."
BooleanResult
The answer to a BooleanQuestion.
BoundingBox
A box in pixels of the input image, as Google's C API reports it, not clipped to the image.
CategoryMask
The winning category index per pixel, in row-major input-image coordinates, owned by the result and valid after the task is disposed.
ChoiceQuestion
One of several options for a text: "shipping", "billing" or "other".
ChoiceResult
The answer to a ChoiceQuestion.
Classifications
The categories one classifier head produced, best first.
ConfidenceMask
Per-pixel confidences in row-major input-image coordinates, from 0 to 1, owned by the result and valid after the task is disposed.
DecisionMaker
Google's Decision Maker: answers yes-or-no, choice and score questions about a text with calibrated probabilities, in one forward pass of a small model rather than by generating text.
DecisionMakerOptions
Options for Google's Decision Maker.
DecisionModels
Verified official models accepted by DecisionMakerOptions.
Detection
One detected object or face: its box, categories and, for models that report them, keypoints.
DownloadAsset
A reviewed download. Every location must serve the same pinned bytes.
DownloadFailure
One unsuccessful source.
Embedding
One embedding head's vector: floats, or bytes when quantized.
Landmark
A landmark in world space, in meters from the subject's center.
Matrix
A matrix in column-major order, as Google's C API lays it out.
MediaPipeCategory
One classification: Google's Category, under the package's name because Flutter's foundation library already exports a Category.
MediaPipeWebRuntime
The browser runtime's location, shared by the vision, text and audio packages. Exists on every platform; only browsers read it.
ModelSource
Where a verified model is: a file path on native platforms, bytes in browsers. What ModelStore returns and a task reads.
ModelStore
Verified models shared by every task family: the app's bundled copies, cached in the application's persistent support directory, and downloads when asked for. The same API in browsers, where models live in Cache Storage and a ModelSource holds bytes instead of a path.
NormalizedKeypoint
A point normalized to the input image: 0 to 1 across its width and height.
NormalizedLandmark
A landmark in image space: x and y relative to the image's width and height, z scaled like x with smaller values closer to the camera.
ScoreQuestion
A grade on an ordered rubric, lowest first: "very unhappy" to "very happy".
ScoreResult
The answer to a ScoreQuestion.
TaskCapabilities
Declared package support for one task on a platform: which Delegates run there and why the others do not. This is not an inference self-test.
TaskOptions
Model and delegate shared by every task's options, in every family.
TaskPlatform
The current process platform, including its ABI (not the host CPU's ABI).

Enums

BrowserEngine
A browser's engine, for a task whose browser runtime fails in one of them.
ChoiceScoringMode
How Google's engine scores a choice's options.
Delegate
The processor a task runs on, chosen when the task is created and fixed until it is disposed. One enum serves vision, text and audio.

Functions

decisionMakerCapabilitiesForPlatform(TaskPlatform platform, {DownloadAsset? model}) → TaskCapabilities
Decision Maker support on platform: the CPU on Google's native libraries, and the GPU in browsers once the plugin registers, since Google's browser runtime fails on the CPU. With model, the support for that model: Google's browser runtime fails with EmbeddingGemma 2 in WebKit and with GLiNER2.5-Decide in every browser.
queryDecisionMakerCapabilities([DownloadAsset? model]) → Future<TaskCapabilities>
Query Decision Maker support on this platform without loading a model. Pass model to learn where that model runs: neither EmbeddingGemma 2 model in WebKit, GLiNER2.5-Decide nowhere in browsers, and every other pinned model wherever the task runs.

Typedefs

RuntimeTargets = Map<String, String?>
Minimum product version for one process target, e.g. macos/arm64: 14.0.

Exceptions / Errors

MediaPipeException
A failure from MediaPipe or its supporting runtime.
ModelDownloadException
A model could not be downloaded from any configured source.
RuntimeUnavailableException
The platform cannot load a task runtime required by this operation.
TaskException
A failure Google's runtime reported while creating or running a task, on any platform and in any family.