new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

perplexity/capabilities

12 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Perplexity language model capabilities table

Perplexity language model capabilities: | Model | Image Input | Object Generation | Tool Usage | Tool Streaming | |-------|---|---|---|---| | sonar-deep-research | No | Yes | No | No | | sonar-reasoning-pro | Yes | Yes | No | No | | sonar-reasoning | Yes | Yes | No | No | | sonar-pro | Yes | Yes | No | No | | sonar | Yes | Yes | No | No |

Perplexity sources in response

Websites used to generate the response are included in the `sources` property of the result returned by generateText.

Perplexity provider metadata in response

The response metadata includes: usage (object containing citationTokens and numSearchQueries metrics) and images (array of image objects when return_images is enabled for Tier-2 users only, each containing imageUrl, originUrl, height, and width).

Perplexity PDF file support

The Perplexity provider supports reading PDF files by passing them as part of message content using the file type with data (file buffer or URL), mediaType ('application/pdf'), and optional filename. PDF files can be passed as local files using fs.readFileSync or as URLs using new URL().

Perplexity quantized embeddings

Perplexity returns quantized embeddings (not floating point). Values are decoded to signed int8 values (default) or packed bits per byte. Compare base64_int8 embeddings with cosine similarity and base64_binary embeddings with Hamming distance.

Perplexity embedding cost metadata

When the Perplexity API returns a cost breakdown, it is exposed via providerMetadata.perplexity.cost, containing inputCost, totalCost, and currency fields.

Perplexity generateText example with web search

Example code showing how to use Perplexity with generateText to get responses grounded in current web data: ```ts import { perplexity } from '@ai-sdk/perplexity'; import { generateText } from 'ai'; const { text } = await generateText({ model: perplexity('sonar-pro'), prompt: 'What are the latest developments in quantum computing?', }); ``` This example demonstrates generating text using the sonar-pro model.

Perplexity generateText example with sources

Example code showing how to access sources from a Perplexity response: ```ts import { perplexity } from '@ai-sdk/perplexity'; import { generateText } from 'ai'; const { text, sources } = await generateText({ model: perplexity('sonar-pro'), prompt: 'What are the latest developments in quantum computing?', }); console.log(sources); ``` This example demonstrates extracting the sources used to generate the response.

Perplexity PDF file input example with local file

Example code showing how to pass a local PDF file to Perplexity: ```ts const result = await generateText({ model: perplexity('sonar-pro'), messages: [ { role: 'user', content: [ { type: 'text', text: 'What is this document about?', }, { type: 'file', data: fs.readFileSync('./data/ai.pdf'), mediaType: 'application/pdf', filename: 'ai.pdf', // optional }, ], }, ], }); ``` This example demonstrates reading a local PDF file and passing it as part of the message content.

Perplexity PDF file input example with URL

Example code showing how to pass a PDF file via URL to Perplexity: ```ts { type: 'file', data: new URL('https://example.com/document.pdf'), mediaType: 'application/pdf', filename: 'document.pdf', // optional } ``` This example demonstrates passing a PDF URL instead of a local file.

Perplexity embedding example

Example code showing how to create embeddings using Perplexity: ```ts import { perplexity } from '@ai-sdk/perplexity'; import { embed } from 'ai'; const { embedding } = await embed({ model: perplexity.embedding('pplx-embed-v1-4b'), value: 'sunny day at the beach', }); ``` This example demonstrates creating an embedding using the pplx-embed-v1-4b model.

Perplexity embedding with cost metadata example

Example code showing how to access cost metadata from Perplexity embeddings: ```ts const { embedding, providerMetadata } = await embed({ model: perplexity.embedding('pplx-embed-v1-4b'), value: 'sunny day at the beach', }); console.log(providerMetadata?.perplexity?.cost); // { inputCost: 0.0001, totalCost: 0.0001, currency: 'USD' } ``` This example demonstrates extracting cost information from the provider metadata.

Give your agent this brain