From 028fcb769969c5ba9e7ee94b34bd4542a29df734 Mon Sep 17 00:00:00 2001 From: Kesku Date: Sat, 22 Nov 2025 00:26:45 +0000 Subject: [PATCH 1/3] Add Perplexity Search tool to registry and documentation --- .../cookbook/05-node/56-web-search-agent.mdx | 33 ++++++++++++++++++- content/docs/02-foundations/04-tools.mdx | 1 + content/tools-registry/registry.ts | 32 ++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/content/cookbook/05-node/56-web-search-agent.mdx b/content/cookbook/05-node/56-web-search-agent.mdx index e8e44b1f3a62..db6ea75b2868 100644 --- a/content/cookbook/05-node/56-web-search-agent.mdx +++ b/content/cookbook/05-node/56-web-search-agent.mdx @@ -131,7 +131,38 @@ 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. + +#### Perplexity Search + +Get your API key from the [Perplexity API Keys page](https://www.perplexity.ai/account/api/keys). + +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'; +import { openai } from '@ai-sdk/openai'; + +const { text } = await generateText({ + model: 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); +``` + +For more configuration options and customization, see the [Perplexity Search API documentation](https://docs.perplexity.ai/guides/search-quickstart). #### Exa diff --git a/content/docs/02-foundations/04-tools.mdx b/content/docs/02-foundations/04-tools.mdx index a621b8017ef8..6ea60ab4c52f 100644 --- a/content/docs/02-foundations/04-tools.mdx +++ b/content/docs/02-foundations/04-tools.mdx @@ -148,6 +148,7 @@ When you work with tools, you typically need a mix of application-specific tools These packages provide pre-built tools you can install and use immediately: +- **[@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. - **[@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. - **[Stripe agent tools](https://docs.stripe.com/agents?framework=vercel)** - Tools for interacting with Stripe. diff --git a/content/tools-registry/registry.ts b/content/tools-registry/registry.ts index 381478f9daee..cb3f69ea8aa6 100644 --- a/content/tools-registry/registry.ts +++ b/content/tools-registry/registry.ts @@ -115,4 +115,36 @@ 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', + }, ]; From c779b807d0946abdca83dae0d3ad017ba0d21def Mon Sep 17 00:00:00 2001 From: nicoalbanese Date: Tue, 2 Dec 2025 18:13:23 +0000 Subject: [PATCH 2/3] updates and format --- .../cookbook/05-node/56-web-search-agent.mdx | 65 ++++++++++--------- content/docs/02-foundations/04-tools.mdx | 2 +- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/content/cookbook/05-node/56-web-search-agent.mdx b/content/cookbook/05-node/56-web-search-agent.mdx index a83437e228bd..b6390f26a792 100644 --- a/content/cookbook/05-node/56-web-search-agent.mdx +++ b/content/cookbook/05-node/56-web-search-agent.mdx @@ -132,37 +132,6 @@ Unlike the native web search examples where searching is built into the model, u 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. -#### Perplexity Search - -Get your API key from the [Perplexity API Keys page](https://www.perplexity.ai/account/api/keys). - -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'; -import { openai } from '@ai-sdk/openai'; - -const { text } = await generateText({ - model: 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); -``` - -For more configuration options and customization, see the [Perplexity Search API documentation](https://docs.perplexity.ai/guides/search-quickstart). - #### Exa @@ -224,6 +193,40 @@ const { text } = await generateText({ console.log(text); ``` +#### Perplexity Search + + + Get your API key from the [Perplexity API Keys + page](https://www.perplexity.ai/account/api/keys). + + +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 diff --git a/content/docs/02-foundations/04-tools.mdx b/content/docs/02-foundations/04-tools.mdx index d2b995e760a7..81d20d9c0789 100644 --- a/content/docs/02-foundations/04-tools.mdx +++ b/content/docs/02-foundations/04-tools.mdx @@ -148,9 +148,9 @@ When you work with tools, you typically need a mix of application-specific tools These packages provide pre-built tools you can install and use immediately: -- **[@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. - **[@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. From 04de6d7a86667895a6dbeb35f8d40bef6fc0c197 Mon Sep 17 00:00:00 2001 From: nicoalbanese Date: Tue, 2 Dec 2025 18:14:45 +0000 Subject: [PATCH 3/3] prettier --- content/tools-registry/registry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tools-registry/registry.ts b/content/tools-registry/registry.ts index 7cad05c828b9..fa366af17a84 100644 --- a/content/tools-registry/registry.ts +++ b/content/tools-registry/registry.ts @@ -122,7 +122,7 @@ console.log(text);`, 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.', + "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',