<p align="center"><a href="https://withone.ai"><img src="https://cdn.jsdelivr.net/npm/@withone/platform-perplexity/banner.svg" alt="One and Perplexity" width="640"></a></p>
<h1 align="center">Perplexity on One</h1>
<p align="center">Typed Perplexity actions for the <a href="https://withone.ai">One</a> SDK.</p>
<p align="center"><a href="https://withone.ai">Website</a> · <a href="https://withone.ai/docs">Docs</a> · <a href="https://withone.ai/knowledge/perplexity">Perplexity on One</a> · <a href="https://app.withone.ai">Dashboard</a></p>
## Perplexity
Perplexity is an AI-powered search and answer engine that provides real-time, cited answers using large language models. It's designed for knowledge discovery and in-depth research.
## What this package is
[One](https://withone.ai) is a unified API for third-party platforms: connect an account once, then call any of its actions through one client with the credentials, retries and routing handled for you. `withone-perplexity` holds the 30 typed Perplexity actions, each taking exactly the input that action needs and checked when you build. The client itself lives in [`withone`](https://crates.io/crates/withone), which every platform package shares.
## Install
```bash
cargo add withone withone-perplexity
```
## Quick start
1. Create a secret key in the [One dashboard](https://app.withone.ai/settings/api-keys) and export it as `ONE_SECRET`.
2. Connect a Perplexity account in the [dashboard](https://app.withone.ai) and copy its connection key.
3. Run an action on that connection:
```rust
use one::One;
use withone_perplexity as perplexity;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let one = One::from_env()?;
let response = one
.connection(std::env::var("ONE_CONNECTION_KEY")?)
.run(perplexity::create_embeddings() /* set the action's fields */)
.await?;
let body: serde_json::Value = response.json()?;
println!("{body:#}");
Ok(())
}
```
## Actions
This package carries 30 typed actions, among them:
- `create_embeddings`
- `get_async_chat_completion_response`
- `search_web`
- `list_async_chat_completions_authenticated_user`
- `create_contextualized_embeddings`
- `create_agent_response`
- `create_chat_completion`
- `create_async_chat_completion_sonar`
- `download_file_content`
- `delete_file`
- `cancel_batch`
- `create_batch`
Every action, with its inputs, outputs and behaviour, is on [Perplexity on One](https://withone.ai/knowledge/perplexity).
## Links
- [One](https://withone.ai) and its [documentation](https://withone.ai/docs)
- [`withone`](https://crates.io/crates/withone), the client this package builds on
- [`@withone/platform-perplexity`](https://www.npmjs.com/package/@withone/platform-perplexity), the same actions for the other language
## License
MIT