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

# Decisions Quickstart

> Ask your first question about your content and get a probability back.

## Installation

```bash Python theme={null}
pip install "perplexityai>=0.44.0"
```

```bash Typescript theme={null}
npm install "@perplexity-ai/perplexity_ai@>=0.39.0"
```

## Authentication

Create a key in the [API Console](https://console.perplexity.ai), then set it in your environment:

> [tab] macOS/Linux
>
> ```bash theme={null}
> export PERPLEXITY_API_KEY="your_api_key_here"
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={null}
> $env:PERPLEXITY_API_KEY="your_api_key_here"
> ```

## Make a request

```python Python theme={null}
from perplexity import Perplexity

client = Perplexity(timeout=30.0)

response = client.decisions.create(
    model="pplx-decider-latest",
    state="The headphones sound great, but the battery stopped charging after two weeks.",
    questions={
        "defect": {"type": "noul", "instructions": "Does the review report a product defect?"},
    },
)

print(response.answers["defect"].noul)
```

```typescript Typescript theme={null}
import Perplexity from "@perplexity-ai/perplexity_ai";

const client = new Perplexity({ timeout: 30_000 });

const response = await client.decisions.create({
  model: "pplx-decider-latest",
  state: "The headphones sound great, but the battery stopped charging after two weeks.",
  questions: {
    defect: { type: "noul", instructions: "Does the review report a product defect?" },
  },
});

const { defect } = response.answers;
if (defect?.type === "noul") console.log(defect.noul);
```

```bash cURL theme={null}
curl -X POST 'https://api.perplexity.ai/v1/decisions' \
  -H "Authorization: Bearer $PERPLEXITY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "pplx-decider-latest",
    "state": "The headphones sound great, but the battery stopped charging after two weeks.",
    "questions": {
      "defect": {"type": "noul", "instructions": "Does the review report a product defect?"}
    }
  }' | jq
```

`noul` is the probability of yes, from 0 to 1. Example response, with `usage` omitted:

```json theme={null}
{
  "model": "pplx-decider-latest",
  "answers": {
    "defect": {"type": "noul", "noul": 0.94}
  }
}
```

See [Decisions](https://docs.perplexity.ai/docs/decisions/decisions.md) for question types, images, web grounding, and models.
