> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ZoomDecisionsClassifier

> ZoomDecisionsClassifier and ZoomDecisionsClient answer classifier questions, about images too, through Zoom's Decisions API.

## Overview

`ZoomDecisionsClassifier` answers [classifier questions](https://docs.pipecat.ai/api-reference/server/classifiers/overview.md) through the Decisions API from Zoom AI Services. All the questions about one state go to Zoom in one request. Structured state, instructions, and descriptions are sent as JSON.

A `ZoomDecisionsClassifier` asks through a `ZoomDecisionsClient`, which holds the HTTP/2 connection, adds the auth header, retries when Zoom is busy, and counts tokens. Build the classifier with an API key to give it a client of its own, or pass a `ZoomDecisionsClient` to share one connection between several classifiers.

> [card] [Classifier Questions](https://github.com/pipecat-ai/pipecat/blob/main/examples/features/features-classifiers.py)
>
> Ask yes/no, choice, and score questions about a call transcript. Run with
> `--zoom`.

> [card] [Questions About an Image](https://github.com/pipecat-ai/pipecat/blob/main/examples/features/features-classifiers-images.py)
>
> Ask about an image, such as a frame from a camera. Run with `--zoom`.

## Installation

```bash theme={null}
uv add "pipecat-ai[zoom-ai]"
```

## Prerequisites

A Zoom AI Services API key, usually set as an environment variable:

```bash theme={null}
ZOOM_AI_API_KEY=...
```

## Configuration

### ZoomDecisionsClassifier

```python theme={null}
from pipecat.classifiers.zoom.decisions.classifier import ZoomDecisionsClassifier
```

**api\_key** `str | None` (default: None)

Zoom AI Services API key, when the classifier should have a client of its own.
One of `api_key` and `client` is required.

**client** `ZoomDecisionsClient | None` (default: None)

A client to share with other classifiers. One of `api_key` and `client` is
required.

**model** `str` (default: zoom-decisions)

The decision model a client of its own asks: `zoom-decisions` or
`zoom-decisions-pro`.

**url** `str` (default: [https://api.zoom.us/v2/aiservices/decisions/decide](https://api.zoom.us/v2/aiservices/decisions/decide))

Where a client of its own sends its questions.

**timeout** `float` (default: 10.0)

Seconds a client of its own waits for an answer, retries included, before
raising `ClassifierError`.

**name** `str | None` (default: None)

Name of the classifier, as it appears in logs and metrics.

### ZoomDecisionsClient

```python theme={null}
from pipecat.classifiers.zoom.decisions.client import ZoomDecisionsClient
```

**api\_key** `str` *required*

Zoom AI Services API key.

**url** `str` (default: [https://api.zoom.us/v2/aiservices/decisions/decide](https://api.zoom.us/v2/aiservices/decisions/decide))

The `decide` endpoint. A plaintext `http://` URL to a remote host logs a
warning.

**model** `str` (default: zoom-decisions)

The decision model to ask: `zoom-decisions` or `zoom-decisions-pro`.

**timeout** `float` (default: 10.0)

Seconds to wait for an answer, retries included, before raising
`ClassifierError`.

**max\_retries** `int` (default: 3)

How many times to retry a request Zoom refused because it was busy (HTTP 429
or 503), with exponential backoff that waits at least as long as Zoom's
`Retry-After` header asks.

## Usage

### Basic Usage

```python theme={null}
import os

from pipecat.classifiers.base_classifier import YesNoQuestion
from pipecat.classifiers.zoom.decisions.classifier import ZoomDecisionsClassifier

classifier = ZoomDecisionsClassifier(api_key=os.getenv("ZOOM_AI_API_KEY"))

results = await classifier.yes_no(
    "Hi, you've reached Dana. Leave a message.",
    {"voicemail": YesNoQuestion(instructions="is this a voicemail?")},
)
results["voicemail"].is_yes
results["voicemail"].probability
```

Most of the time you don't call the classifier yourself: you pass it to a component that asks it, such as [`VoicemailDetector`](https://docs.pipecat.ai/api-reference/server/extensions/voicemail) or [`UIWorker`](https://docs.pipecat.ai/api-reference/server/workers/ui-worker).

### Sharing a Client

Several classifiers can share one `ZoomDecisionsClient`, and with it one connection pool and one token count:

```python theme={null}
from pipecat.classifiers.zoom.decisions.classifier import ZoomDecisionsClassifier
from pipecat.classifiers.zoom.decisions.client import ZoomDecisionsClient

client = ZoomDecisionsClient(api_key=os.getenv("ZOOM_AI_API_KEY"))

voicemail = VoicemailDetector(classifier=ZoomDecisionsClassifier(client=client))
ui_worker = MyUIWorker("ui", llm=ui_llm, classifier=ZoomDecisionsClassifier(client=client))
```

A client the classifier created is closed in the classifier's `cleanup()`. A shared client is left open, so close it yourself with `await client.close()` when every classifier using it is done.

### Asking About Images

The Decisions API can see images. Pass them in `inputs=` to `ask()`, `yes_no()`, `choice()` or `score()`, as [`ClassifierImage`](https://docs.pipecat.ai/api-reference/server/classifiers/overview#classifierimage) objects:

```python theme={null}
from pipecat.classifiers.base_classifier import ClassifierImage

image = await ClassifierImage.from_frame(frame)  # e.g. a frame from the user's camera
results = await classifier.yes_no(
    "A frame from the user's camera.",
    {"person": YesNoQuestion(instructions="Is there a person in the frame?")},
    inputs=[image],
)
```

The images are sent inline as base64 data URLs, ahead of the state, in one user message. Without images, the state is sent as plain text.

### Opening the Connection Early

`setup()` opens the connection to Zoom ahead of the first question, so the first answer does not pay for the TLS handshake. Components that own a classifier, such as `VoicemailDetector`, call it for you. If the connection cannot be opened at setup, a warning is logged and the first question opens it instead.

## ZoomDecisionsClassifier Properties

| Property | Type | Description |
| - | - | - |
| `client` | `ZoomDecisionsClient` | The client this classifier asks through. |
| `model` | `str` | The decision model the questions go to. |
| `supports_images` | `bool` | Always `True`: the Decisions API can see images. |

## ZoomDecisionsClient Reference

### Properties

| Property | Type | Description |
| - | - | - |
| `model` | `str` | The decision model the questions go to. |
| `usage` | `ZoomDecisionsUsage` | Tokens used so far over every request, as `input_tokens`, `output_tokens` and `cached_input_tokens`. |

### Methods

#### connect

```python theme={null}
await client.connect()
```

Opens the connection to Zoom with an `OPTIONS` request to the endpoint, which asks no question. Zoom has no request that checks the key on its own, so a bad key shows on the first question. It connects once: a client shared by several classifiers is connected by each of them, and only the first call sends anything. Raises `ClassifierError` if Zoom could not be reached.

#### close

```python theme={null}
await client.close()
```

Closes the connection pool.

## Metrics

After every call, a `ZoomDecisionsClassifier` reports the time it took as `ProcessingMetricsData` and the tokens used as `LLMUsageMetricsData` through its [`on_metrics`](https://docs.pipecat.ai/api-reference/server/classifiers/overview#on_metrics) event.

## Notes

* **Limits**: one request takes at most 10 questions, a choice question at most 255 options, and a score question at most 10 levels. They are available as `ZOOM_DECISIONS_MAX_QUESTIONS`, `ZOOM_DECISIONS_MAX_CHOICE_OPTIONS` and `ZOOM_DECISIONS_MAX_SCORE_LEVELS` in `pipecat.classifiers.zoom.decisions.classifier`. A request over a limit raises `ClassifierError` before anything is sent.
* **Images**: a call takes up to 4 images, available as `ZOOM_DECISIONS_MAX_IMAGES` in `pipecat.classifiers.zoom.decisions.classifier`. More raises `ClassifierError` before anything is sent.
* **Errors**: a rejected request, a busy Zoom after every retry, an unreachable server, no answer within `timeout`, or a reply missing an answer all raise `ClassifierError`. A message carries Zoom's `x-zm-trackingid` for the request, which Zoom support uses to find it.
* **Idle connections** are kept open for 240 seconds, so a gap between questions does not cost a new TLS handshake.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.