@ai-sdk/perplexity
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

AI SDK - Perplexity Provider

The Perplexity provider for the AI SDK contains language model support for Perplexity's Sonar API - a powerful answer engine with real-time web search capabilities.

Features

  • Real-time web search grounding for accurate, up-to-date responses
  • Support for advanced queries and follow-up questions
  • Multiple tiers available:
    • Sonar Pro: Enhanced capabilities for complex tasks with 2x more citations
    • Sonar: Lightweight offering optimized for speed and cost
  • Industry-leading answer quality
  • Data privacy - no training on customer data
  • Self-serve API access with scalable pricing

Setup

The Perplexity provider is available in the @ai-sdk/perplexity module. You can install it with:

npm i @ai-sdk/perplexity

Provider Instance

You can import the default provider instance perplexity from @ai-sdk/perplexity:

import { perplexity } from '@ai-sdk/perplexity';

Example

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?',
});

Documentation

Please check out the Perplexity provider documentation for more information.

Readme

Keywords

Package Sidebar

Install

npm i @ai-sdk/perplexity

Weekly Downloads

40,216

Version

1.1.7

License

Apache-2.0

Unpacked Size

89.6 kB

Total Files

10

Last publish

Collaborators

  • jaredpalmer
  • vercel-release-bot