Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion content/cookbook/05-node/56-web-search-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Unlike the native web search examples where searching is built into the model, u

### Use ready-made tools

If you prefer a ready-to-use web search tool without building one from scratch, [Exa](https://exa.ai/)(a web search API designed for AI applications) provides a tool that integrates directly with the AI SDK.
If you prefer a ready-to-use web search tool without building one from scratch, there are several options that integrate directly with the AI SDK.

#### Exa

Expand Down Expand Up @@ -193,6 +193,40 @@ const { text } = await generateText({
console.log(text);
```

#### Perplexity Search

<Note>
Get your API key from the [Perplexity API Keys
page](https://www.perplexity.ai/account/api/keys).
</Note>

First, install the Perplexity Search tool:

```bash
pnpm install @perplexity-ai/ai-sdk
```

Then, you can import and pass it into `generateText`, `streamText`, or your agent. Perplexity Search provides real-time web search with advanced filtering options including domain, language, date range, and recency filters:

```ts
import { generateText, stepCountIs } from 'ai';
import { perplexitySearch } from '@perplexity-ai/ai-sdk';

const { text } = await generateText({
model: 'anthropic/claude-sonnet-4-5',
prompt:
'What are the latest AI developments? Use search to find current information.',
tools: {
search: perplexitySearch(),
},
stopWhen: stepCountIs(3),
});

console.log(text);
```

For more configuration options and customization, see the [Perplexity Search API documentation](https://docs.perplexity.ai/guides/search-quickstart).

#### Tavily

<Note>
Expand Down
1 change: 1 addition & 0 deletions content/docs/02-foundations/04-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ These packages provide pre-built tools you can install and use immediately:

- **[@exalabs/ai-sdk](https://www.npmjs.com/package/@exalabs/ai-sdk)** - Web search tool that lets AI search the web and get real-time information.
- **[@parallel-web/ai-sdk-tools](https://www.npmjs.com/package/@parallel-web/ai-sdk-tools)** - Web search and extract tools powered by Parallel Web API for real-time information and content extraction.
- **[@perplexity-ai/ai-sdk](https://www.npmjs.com/package/@perplexity-ai/ai-sdk)** - Search the web with real-time results and advanced filtering powered by Perplexity's Search API.
- **[@tavily/ai-sdk](https://www.npmjs.com/package/@tavily/ai-sdk)** - Search, extract, crawl, and map tools for enterprise-grade agents to explore the web in real-time.
- **[Stripe agent tools](https://docs.stripe.com/agents?framework=vercel)** - Tools for interacting with Stripe.
- **[StackOne ToolSet](https://docs.stackone.com/agents/typescript/frameworks/vercel-ai-sdk)** - Agentic integrations for hundreds of [enterprise SaaS](https://www.stackone.com/integrations) platforms.
Expand Down
32 changes: 32 additions & 0 deletions content/tools-registry/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,38 @@ console.log(text);`,
websiteUrl: 'https://parallel.ai',
npmUrl: 'https://www.npmjs.com/package/@parallel-web/ai-sdk-tools',
},
{
slug: 'perplexity-search',
name: 'Perplexity Search',
description:
"Search the web with real-time results and advanced filtering powered by Perplexity's Search API. Provides ranked search results with domain, language, date range, and recency filters. Supports multi-query searches and regional search results.",
packageName: '@perplexity-ai/ai-sdk',
tags: ['search', 'web'],
apiKeyEnvName: 'PERPLEXITY_API_KEY',
installCommand: {
pnpm: 'pnpm install @perplexity-ai/ai-sdk',
npm: 'npm install @perplexity-ai/ai-sdk',
yarn: 'yarn add @perplexity-ai/ai-sdk',
bun: 'bun add @perplexity-ai/ai-sdk',
},
codeExample: `import { generateText, gateway, stepCountIs } from 'ai';
import { perplexitySearch } from '@perplexity-ai/ai-sdk';

const { text } = await generateText({
model: gateway('openai/gpt-4o-mini'),
prompt: 'What are the latest AI developments? Use search to find current information.',
tools: {
search: perplexitySearch(),
},
stopWhen: stepCountIs(3),
});

console.log(text);`,
docsUrl: 'https://docs.perplexity.ai/guides/search-quickstart',
apiKeyUrl: 'https://www.perplexity.ai/account/api/keys',
websiteUrl: 'https://www.perplexity.ai',
npmUrl: 'https://www.npmjs.com/package/@perplexity-ai/ai-sdk',
},
{
slug: 'tavily',
name: 'Tavily',
Expand Down
Loading