Skip to main content
The Perplexity Search API returns real-time, grounded web search results. PerplexitySearchResults is a LangChain tool wrapper that lets agents query the API and receive a JSON array of search results.

Overview

Integration details

Setup

The integration lives in the @langchain/perplexity package:

Credentials

Set up a Perplexity API key and set it as an environment variable named PERPLEXITY_API_KEY:
It’s also helpful (but not needed) to set up LangSmith for best-in-class observability:

Instantiation

Constructor options include maxResults, country, searchDomainFilter, searchRecencyFilter, searchAfterDate, and searchBeforeDate. See the Perplexity Search API parameters for details.

Invocation

Direct call

The tool returns a JSON-encoded array of search results, each with title, url, snippet, date, and last_updated.

Use with an agent

API reference

For detailed documentation of all PerplexitySearchResults features and configurations head to the API reference.