通过Vercel AI Gateway为任何模型接入Perplexity网络搜索

来源: Vercel News

原文

You can now give any model the ability to search the web using Perplexity through Vercel's AI Gateway.

AI Gateway supports Perplexity Search as a universal web search tool that works with all models, regardless of provider. Unlike native search tools that are exclusive to specific providers, Perplexity Search can be added to all models.

To use Perplexity Search with the AI SDK, import gateway.tools.perplexitySearch() from @ai-sdk/gateway and pass it in the tools parameter as perplexity_search to any model.

Some example use cases include:

Models without native search: Enable web search on models like zai/glm-4.7 or any from any other providers that don't expose a built-in search tool.

Developer tooling and CI assistants: Get current package versions, recently merged PRs, release notes, or docs updates.

Consistency with fallbacks: Maintain search behavior across multiple providers without rewriting search logic.

For more information, see the AI Gateway Perplexity Web Search docs.

Read more