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.

概述

集成详情

设置

The integration lives in the @langchain/perplexity package:

凭证

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:

实例化

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

调用

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 参考

有关所有 PerplexitySearchResults 功能和配置的详细文档,请前往 API 参考