<br />

MediaPipe Task that performs semantic decision making.

**Signature:**

```typescript
export declare class DecisionMaker extends TaskRunner 
```

## Properties

| Property | Modifiers | Type | Description |
|---|---|---|---|
| [contextWindow](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakercontextwindow) |   | number | Maximum token window supported by the active model/session. |
| [contextUsage](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakercontextusage) |   | number | Estimated token usage of the active schema and most recent evaluation. |

## Methods

| Method | Modifiers | Description |
|---|---|---|
| [createFromOptions(wasmFileset, options)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakercreatefromoptions) | `static` | Initializes the Wasm runtime and creates a new Decision based on options. |
| [createFromModelPath(wasmFileset, modelAssetPath, backendType, maxNumTokens)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakercreatefrommodelpath) | `static` | Initializes the Wasm runtime and creates a new Decision from model asset path. |
| [createFromModelBuffer(wasmFileset, modelAssetBuffer, backendType, maxNumTokens)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakercreatefrommodelbuffer) | `static` | Initializes the Wasm runtime and creates a new Decision from model buffer. |
| [setSchema(schema)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakersetschema) |   | Updates the session-bound ClassifierSchema used by `classify()`. |
| [prewarm(schema)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerprewarm) |   | Prewarms the underlying engine KV/prefix cache for the given schema. |
| [prewarmChoice(question)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerprewarmchoice) |   | Prewarms candidate choice options in Wasm memory before evaluation. |
| [prewarmBoolean(question)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerprewarmboolean) |   | Prewarms a boolean predicate question in Wasm memory before evaluation. |
| [prewarmScore(question)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerprewarmscore) |   | Prewarms an ordinal score rubric question in Wasm memory before evaluation. |
| [measureContextUsage(input, options)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakermeasurecontextusage) |   | Estimates the total token usage for evaluating `input` (and optional per-call `context`) against the session schema. |
| [setOptions(options)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakersetoptions) |   | Sets the options for the DecisionMaker and initializes the underlying engine. Options cannot be updated once the engine has been created. |
| [evaluateBoolean(text, question)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluateboolean) |   | Evaluates a Boolean Predicate condition against input text or multimodal context. |
| [evaluateChoice(text, question)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluatechoice) |   | Evaluates a Categorical Choice against input text or multimodal context. |
| [evaluateScore(text, question)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluatescore) |   | Evaluates an Ordinal Score rubric against input text or multimodal context. |
| [evaluate(input, schema, options)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluate) |   | Evaluates a multi-question `ClassifierSchema` against `input` and returns a unified `ClassifierResult` record keyed by question `id` (compatible with `window.Classifier`). |
| [evaluateBatch(inputs, schema, options)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluatebatch) |   | Evaluates a multi-question `ClassifierSchema` across a batch of `inputs`. |
| [classify(input, options)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerclassify) |   | Evaluates `input` against the session-bound `ClassifierSchema` configured via `DecisionMakerOptions` or `setSchema()`. |
| [evaluateBooleanBatch(texts, question, sharedPrefix)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluatebooleanbatch) |   | Evaluates a Boolean Predicate condition against a batch of input texts (with an optional sharedPrefix for candidate batching). |
| [evaluateChoiceBatch(texts, question, sharedPrefix)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluatechoicebatch) |   | Evaluates a Categorical Choice against a batch of input texts (with an optional sharedPrefix for candidate batching). |
| [evaluateScoreBatch(texts, question, sharedPrefix)](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerevaluatescorebatch) |   | Evaluates an Ordinal Score rubric against a batch of input texts (with an optional sharedPrefix for candidate batching). |
| [close()](https://developers.google.com/edge/api/mediapipe/js/tasks-decision.decisionmaker.md.txt#decisionmakerclose) |   | Closes the DecisionMaker and releases the native engine and model memory. |

## DecisionMaker.contextWindow {#decisionmakercontextwindow}

Maximum token window supported by the active model/session.

**Signature:**

```typescript
get contextWindow(): number;
```

## DecisionMaker.contextUsage {#decisionmakercontextusage}

Estimated token usage of the active schema and most recent evaluation.

**Signature:**

```typescript
get contextUsage(): number;
```

## DecisionMaker.createFromOptions() {#decisionmakercreatefromoptions}

Initializes the Wasm runtime and creates a new Decision based on options.

**Signature:**

```typescript
static createFromOptions(wasmFileset: WasmFileset, options: DecisionMakerOptions): Promise<DecisionMaker>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| options | DecisionMakerOptions | The options for the DecisionMaker. Note that either a path to the model or the model itself needs to be provided (via `baseOptions`). |

**Returns:**

Promise\<DecisionMaker\>

## DecisionMaker.createFromModelPath() {#decisionmakercreatefrommodelpath}

Initializes the Wasm runtime and creates a new Decision from model asset path.

**Signature:**

```typescript
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string, backendType?: number, maxNumTokens?: number): Promise<DecisionMaker>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetPath | string | The path to the model asset. |
| backendType | number | The backend type (0=AUTO, 1=ENCODER, 2=DIRECT_LOGIT, 3=EMBEDDING). |
| maxNumTokens | number | The maximum number of tokens in prompt context. |

**Returns:**

Promise\<DecisionMaker\>

## DecisionMaker.createFromModelBuffer() {#decisionmakercreatefrommodelbuffer}

Initializes the Wasm runtime and creates a new Decision from model buffer.

**Signature:**

```typescript
static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array | ReadableStreamDefaultReader, backendType?: number, maxNumTokens?: number): Promise<DecisionMaker>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetBuffer | Uint8Array \| ReadableStreamDefaultReader | An array or a stream containing a binary representation of the model. |
| backendType | number | The backend type (0=AUTO, 1=ENCODER, 2=DIRECT_LOGIT, 3=EMBEDDING). |
| maxNumTokens | number | The maximum number of tokens in prompt context. |

**Returns:**

Promise\<DecisionMaker\>

## DecisionMaker.setSchema() {#decisionmakersetschema}

Updates the session-bound ClassifierSchema used by `classify()`.

**Signature:**

```typescript
setSchema(schema: ClassifierSchema): void;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| schema | ClassifierSchema | The schema to bind to this session. |

**Returns:**

void

## DecisionMaker.prewarm() {#decisionmakerprewarm}

Prewarms the underlying engine KV/prefix cache for the given schema.

**Signature:**

```typescript
prewarm(schema: ClassifierSchema): Promise<void>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| schema | ClassifierSchema | The schema whose shared prefix should be prewarmed. |

**Returns:**

Promise\<void\>

## DecisionMaker.prewarmChoice() {#decisionmakerprewarmchoice}

Prewarms candidate choice options in Wasm memory before evaluation.

**Signature:**

```typescript
prewarmChoice(question: ChoiceQuestion): Promise<void>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| question | ChoiceQuestion | The categorical choice question whose options should be prewarmed. |

**Returns:**

Promise\<void\>

## DecisionMaker.prewarmBoolean() {#decisionmakerprewarmboolean}

Prewarms a boolean predicate question in Wasm memory before evaluation.

**Signature:**

```typescript
prewarmBoolean(question: BooleanQuestion): Promise<void>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| question | BooleanQuestion | The boolean question to prewarm. |

**Returns:**

Promise\<void\>

## DecisionMaker.prewarmScore() {#decisionmakerprewarmscore}

Prewarms an ordinal score rubric question in Wasm memory before evaluation.

**Signature:**

```typescript
prewarmScore(question: ScoreQuestion): Promise<void>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| question | ScoreQuestion | The score question to prewarm. |

**Returns:**

Promise\<void\>

## DecisionMaker.measureContextUsage() {#decisionmakermeasurecontextusage}

Estimates the total token usage for evaluating `input` (and optional per-call `context`) against the session schema.

**Signature:**

```typescript
measureContextUsage(input: string, options?: ClassifierEvaluateOptions): Promise<number>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| input | string | The input text to be evaluated. |
| options | ClassifierEvaluateOptions | Optional per-call evaluation options. |

**Returns:**

Promise\<number\>

## DecisionMaker.setOptions() {#decisionmakersetoptions}

Sets the options for the DecisionMaker and initializes the underlying engine. Options cannot be updated once the engine has been created.

**Signature:**

```typescript
setOptions(options: DecisionMakerOptions): Promise<void>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| options | DecisionMakerOptions | The options for the DecisionMaker. |

**Returns:**

Promise\<void\>

## DecisionMaker.evaluateBoolean() {#decisionmakerevaluateboolean}

Evaluates a Boolean Predicate condition against input text or multimodal context.

**Signature:**

```typescript
evaluateBoolean(text: string | DecisionContextInput, question: BooleanQuestion): Promise<BooleanResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| text | string \| DecisionContextInput | The input text or multimodal context to be evaluated. |
| question | BooleanQuestion | The boolean question to evaluate. |

**Returns:**

Promise\<BooleanResult\>

## DecisionMaker.evaluateChoice() {#decisionmakerevaluatechoice}

Evaluates a Categorical Choice against input text or multimodal context.

**Signature:**

```typescript
evaluateChoice(text: string | DecisionContextInput, question: ChoiceQuestion): Promise<ChoiceResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| text | string \| DecisionContextInput | The input text or multimodal context to be evaluated. |
| question | ChoiceQuestion | The choice question to evaluate. |

**Returns:**

Promise\<ChoiceResult\>

## DecisionMaker.evaluateScore() {#decisionmakerevaluatescore}

Evaluates an Ordinal Score rubric against input text or multimodal context.

**Signature:**

```typescript
evaluateScore(text: string | DecisionContextInput, question: ScoreQuestion): Promise<ScoreResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| text | string \| DecisionContextInput | The input text or multimodal context to be evaluated. |
| question | ScoreQuestion | The score question to evaluate. |

**Returns:**

Promise\<ScoreResult\>

## DecisionMaker.evaluate() {#decisionmakerevaluate}

Evaluates a multi-question `ClassifierSchema` against `input` and returns a unified `ClassifierResult` record keyed by question `id` (compatible with `window.Classifier`).

**Signature:**

```typescript
evaluate(input: string | DecisionContextInput, schema: ClassifierSchema, options?: ClassifierEvaluateOptions): Promise<ClassifierResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| input | string \| DecisionContextInput | The input text or multimodal context to be evaluated. |
| schema | ClassifierSchema | The schema containing the questions to evaluate. |
| options | ClassifierEvaluateOptions | Optional per-call evaluation options. |

**Returns:**

Promise\<ClassifierResult\>

## DecisionMaker.evaluateBatch() {#decisionmakerevaluatebatch}

Evaluates a multi-question `ClassifierSchema` across a batch of `inputs`.

**Signature:**

```typescript
evaluateBatch(inputs: Array<string | DecisionContextInput>, schema: ClassifierSchema, options?: ClassifierEvaluateOptions): Promise<ClassifierResult[]>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| inputs | Array\<string \| DecisionContextInput\> | The input texts or multimodal contexts to be evaluated. |
| schema | ClassifierSchema | The schema containing the questions to evaluate. |
| options | ClassifierEvaluateOptions | Optional per-call evaluation options. |

**Returns:**

Promise\<ClassifierResult\[\]\>

## DecisionMaker.classify() {#decisionmakerclassify}

Evaluates `input` against the session-bound `ClassifierSchema` configured via `DecisionMakerOptions` or `setSchema()`.

**Signature:**

```typescript
classify(input: string | DecisionContextInput, options?: ClassifierEvaluateOptions): Promise<ClassifierResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| input | string \| DecisionContextInput | The input text or multimodal context to be evaluated. |
| options | ClassifierEvaluateOptions | Optional per-call evaluation options. |

**Returns:**

Promise\<ClassifierResult\>

## DecisionMaker.evaluateBooleanBatch() {#decisionmakerevaluatebooleanbatch}

Evaluates a Boolean Predicate condition against a batch of input texts (with an optional sharedPrefix for candidate batching).

**Signature:**

```typescript
evaluateBooleanBatch(texts: string[], question: BooleanQuestion, sharedPrefix?: string): Promise<BooleanResult[]>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| texts | string\[\] | The input texts to be evaluated. |
| question | BooleanQuestion | The boolean question to evaluate. |
| sharedPrefix | string | An optional prefix shared by all inputs. |

**Returns:**

Promise\<BooleanResult\[\]\>

## DecisionMaker.evaluateChoiceBatch() {#decisionmakerevaluatechoicebatch}

Evaluates a Categorical Choice against a batch of input texts (with an optional sharedPrefix for candidate batching).

**Signature:**

```typescript
evaluateChoiceBatch(texts: string[], question: ChoiceQuestion, sharedPrefix?: string): Promise<ChoiceResult[]>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| texts | string\[\] | The input texts to be evaluated. |
| question | ChoiceQuestion | The choice question to evaluate. |
| sharedPrefix | string | An optional prefix shared by all inputs. |

**Returns:**

Promise\<ChoiceResult\[\]\>

## DecisionMaker.evaluateScoreBatch() {#decisionmakerevaluatescorebatch}

Evaluates an Ordinal Score rubric against a batch of input texts (with an optional sharedPrefix for candidate batching).

**Signature:**

```typescript
evaluateScoreBatch(texts: string[], question: ScoreQuestion, sharedPrefix?: string): Promise<ScoreResult[]>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| texts | string\[\] | The input texts to be evaluated. |
| question | ScoreQuestion | The score question to evaluate. |
| sharedPrefix | string | An optional prefix shared by all inputs. |

**Returns:**

Promise\<ScoreResult\[\]\>

## DecisionMaker.close() {#decisionmakerclose}

Closes the DecisionMaker and releases the native engine and model memory.

**Signature:**

```typescript
close(): void;
```

**Returns:**

void