# Perplexity

To use a language model hosted on Perplexity, specify `perplexity` in the `from` field.

To use a specific model, include its model ID in the `from` field (see example below). If not specified, the default model is `sonar`.

```yaml
models:
  - name: webs
    from: perplexity:sonar
    params:
      perplexity_auth_token: ${ secrets:SPICE_PERPLEXITY_AUTH_TOKEN }
```

The following parameters are specific to Perplexity models:

| Parameter               | Description                                                                                                                                                  | Default |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| `perplexity_auth_token` | The Perplexity API authentication token.                                                                                                                     | -       |
| `perplexity_*`          | Additional, perplexity specific parameters to use on all requests. See [Perplexity API Reference](https://docs.perplexity.ai/api-reference/chat-completions) | -       |

**Note:** Like other models in Spice, Perplexity can set default overrides for OpenAI parameters. See [Parameter Overrides](https://github.com/spicehq/docs/blob/trunk/features/large-language-models/parameter_overrides.md).

### Example Configuration

```yaml
models:
  - name: webs
    from: perplexity:sonar
    params:
      perplexity_auth_token: ${ secrets:SPICE_PERPLEXITY_AUTH_TOKEN }
      perplexity_search_domain_filter:
        - docs.spiceai.org
        - huggingface.co
      perplexity_temperature: 0.3141595
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spice.ai/building-blocks/model-providers/perplexity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
