Documentation Index
Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-mdrxyo-1777658790-7be347c.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Perplexity Search is a web search API that returns ranked, source-attributed results designed for use by LLMs and agents. The Search API endpoint returns the underlying web results that power Perplexity’s answer engine.We can use this as a retriever. It will show functionality specific to this integration. After going through, it may be useful to explore relevant use-case pages to learn how to use this retriever as part of a larger chain.
Setup
Installation
The integration lives in thelangchain-perplexity package:
Credentials
You’ll need a Perplexity API key to use this integration. Create one in the Perplexity API key dashboard, then set it as thePPLX_API_KEY environment variable (the integration also accepts PERPLEXITY_API_KEY).
Instantiation
PerplexitySearchRetriever accepts the following constructor arguments:
k— max number of results (1–20). Defaults to10.max_tokens— max total tokens across all results.max_tokens_per_page— max tokens returned per result page.country— ISO country code to bias results (e.g."US").search_domain_filter— list of domains to include or exclude (max 20). Prefix a domain with-to exclude it. See the domain filter docs.search_recency_filter— one of"day","week","month","year". See the date and time filter docs.search_after_date/search_before_date— date strings inMM/DD/YYYYformat.
Usage
Document has the result snippet as its page_content, plus title, url, date, and last_updated in metadata.
Filtered usage
You can constrain the search with the same filters supported by the Perplexity Search API:Use within a chain
We can easily combine this retriever into a chain to build a simple RAG pipeline.API reference
For detailed documentation of the Perplexity Search API and all of its options, see the Search API reference and the Perplexity API documentation.Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

