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.
# Add to your .env filePERPLEXITY_API_KEY=your_api_key_here
Usage
import{ generateText, isStepCount }from'ai';import{ perplexitySearch }from'@perplexity-ai/ai-sdk';const{text}=awaitgenerateText({ model:'openai/gpt-6-astra', prompt:'What are the latest AI developments? Use search to find current information.', tools:{ search:perplexitySearch(),}, stopWhen:isStepCount(3),});console.log(text);