Skip to main content
The Perplexity Search API returns real-time, grounded web search results that you can drop directly into a retrieval pipeline.

概述

This will help you get started with PerplexitySearchRetriever retrieval. For detailed documentation of all PerplexitySearchRetriever features and configurations head to the API reference.

集成详情

设置

You will need to populate a PERPLEXITY_API_KEY environment variable with your Perplexity API key, or pass it into the constructor as apiKey. Get a key from the Perplexity API key dashboard.
If you want to get automated tracing from individual queries, you can also set your LangSmith API key by uncommenting below:

安装

This retriever lives in the @langchain/perplexity package:

实例化

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

用法

Each returned Document has the search result snippet as pageContent and { title, url, date, lastUpdated } in metadata.

Use within a chain

Like other retrievers, PerplexitySearchRetriever can be incorporated into LLM applications via chains.

API 参考

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