<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L425-L961) |

MediaPipe Decision task.

```python
mp.tasks.decision.DecisionMaker(
    lib: serial_dispatcher.SerialDispatcher, handle: ctypes.c_void_p
)
```

## Methods

### `close`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L949-L955)

```python
close()
```

Releases resources associated with the task.

### `create_from_model_path`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L436-L441)

```python
@classmethod
create_from_model_path(
    model_path: str
) -> 'DecisionMaker'
```

Creates a Decision task from a model file path.

### `create_from_options`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L443-L458)

```python
@classmethod
create_from_options(
    options: Optional[DecisionMakerOptions] = None
) -> 'DecisionMaker'
```

Creates a Decision task from options.

### `evaluate_batch`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L885-L909)

```python
evaluate_batch(
    contexts: Sequence[Union[str, DecisionContext]],
    questions: Dict[str, QuestionType]
) -> List[DecisionResult]
```

Evaluates N independent contexts against M questions in a batch.

### `evaluate_boolean`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L570-L596)

```python
evaluate_boolean(
    text: str, question: BooleanQuestion
) -> BooleanResult
```

Evaluates a Boolean against input text.

### `evaluate_boolean_batch`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L704-L744)

```python
evaluate_boolean_batch(
    texts: Sequence[Union[str, DecisionContext]],
    question: BooleanQuestion,
    shared_prefix: Optional[str] = None
) -> List[BooleanResult]
```

Evaluates a Boolean against a batch of input texts.

### `evaluate_candidates`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L911-L947)

```python
evaluate_candidates(
    shared_context: Union[str, DecisionContext],
    candidates: Sequence[Union[str, DecisionContext]],
    questions: Dict[str, QuestionType]
) -> List[DecisionResult]
```

Evaluates 1 shared prefix + N candidates against M questions.

### `evaluate_choice`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L598-L655)

```python
evaluate_choice(
    text: str, question: ChoiceQuestion
) -> ChoiceResult
```

Evaluates a Choice against input text.

### `evaluate_choice_batch`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L746-L818)

```python
evaluate_choice_batch(
    texts: Sequence[Union[str, DecisionContext]],
    question: ChoiceQuestion,
    shared_prefix: Optional[str] = None
) -> List[ChoiceResult]
```

Evaluates a Choice against a batch of input texts.

### `evaluate_schema`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L501-L568)

```python
evaluate_schema(
    text: Union[str, DecisionContext], questions: Mapping[str, QuestionType]
) -> DecisionResult
```

Evaluates a multi-question schema simultaneously against input text.

### `evaluate_score`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L657-L702)

```python
evaluate_score(
    text: str, question: ScoreQuestion
) -> ScoreResult
```

Evaluates an Score rubric against input text.

### `evaluate_score_batch`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L820-L883)

```python
evaluate_score_batch(
    texts: Sequence[Union[str, DecisionContext]],
    question: ScoreQuestion,
    shared_prefix: Optional[str] = None
) -> List[ScoreResult]
```

Evaluates an Score rubric against a batch of input texts.

### `prewarm`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L460-L484)

```python
prewarm(
    question: ChoiceQuestion
) -> None
```

Prewarms the static prompt prefix and KV cache for a choice question.

### `prewarm_choice`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L486-L488)

```python
prewarm_choice(
    question: ChoiceQuestion
) -> None
```

Deprecated alias for `prewarm`.

### `prewarm_schema`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L490-L499)

```python
prewarm_schema(
    questions: Mapping[str, QuestionType]
) -> None
```

Prewarms the prompt prefix and caches for a multi-question schema.

### `__enter__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L957-L958)

```python
__enter__()
```

### `__exit__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/decision/decision_maker.py#L960-L961)

```python
__exit__(
    exc_type, exc_val, exc_tb
)
```