Rust

perplexity

Module

Perplexity.

Contents

use utopia_agents::Perplexity;
Rust
pub struct Perplexity(Chat)

Perplexity's OpenAI-compatible chat completions. An HTML error page in the stream (an authorization failure) becomes (http_<status>) <reason> from its title or first heading.

Rust
use utopia_agents::{Adapter, Perplexity};

let adapter = Perplexity::new("test-api-key");
assert_eq!((adapter.name(), adapter.model()), ("perplexity", "sonar"));
Rust
pub const ENDPOINT: &str = "https://api.perplexity.ai/chat/completions"

The chat completions endpoint.

Rust
pub const MODEL_SONAR: &str = "sonar"

Sonar: lightweight search (the default).

Rust
pub const MODEL_SONAR_DEEP_RESEARCH: &str = "sonar-deep-research"

Sonar Deep Research.

Rust
pub const MODEL_SONAR_PRO: &str = "sonar-pro"

Sonar Pro.

Rust
pub const MODEL_SONAR_REASONING: &str = "sonar-reasoning"

Sonar Reasoning.

Rust
pub const MODEL_SONAR_REASONING_PRO: &str = "sonar-reasoning-pro"

Sonar Reasoning Pro.

Rust
pub const MODELS: &[&str] = &[MODEL_SONAR, MODEL_SONAR_PRO, MODEL_SONAR_DEEP_RESEARCH, MODEL_SONAR_REASONING, MODEL_SONAR_REASONING_PRO]

Undocumented.