Skip to main content

Documentation Index

Fetch the complete documentation index at: https://nvd-54.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Perplexity is the most powerful way to search the internet with unlimited Pro Search, upgraded AI models, unlimited file upload, image generation, and API credits. 您可以查看 a list of available models.

安装和设置

Install the Perplexity x LangChain integration package:
pip install langchain-perplexity
获取您的 API 密钥 from the Perplexity API key dashboard and set it as the PERPLEXITY_API_KEY (or PPLX_API_KEY) environment variable. See the Perplexity getting started guide for more details.

聊天模型

See a variety of Perplexity usage examples.
from langchain_perplexity import ChatPerplexity

检索器

您可以使用 PerplexitySearchRetriever to fetch web search results from the Perplexity Search API as Document objects in a standard retrieval pipeline. 查看使用示例.
from langchain_perplexity import PerplexitySearchRetriever

工具

You can use Perplexity as an agent tool to give your agent access to the Perplexity Search API. 查看使用示例.

PerplexitySearchResults

A tool that queries the Perplexity Search API and returns a JSON array of results (title, URL, snippet, date, last updated).
from langchain_perplexity import PerplexitySearchResults

向量嵌入模型

You can use PerplexityEmbeddings to generate embeddings via the Perplexity Embeddings API. 查看使用示例.
from langchain_perplexity import PerplexityEmbeddings

Deep Agents CLI

Use Perplexity as a first-class provider in the Deep Agents CLI. Install the CLI with the Perplexity extra:
uv tool install 'deepagents-cli[perplexity]'
Then set PERPLEXITY_API_KEY and reference Perplexity models with the perplexity: prefix (e.g. perplexity:sonar-pro) in the interactive /model switcher or your config.

Components reference

ClassAbstractionImport pathDescription
ChatPerplexityChat modelfrom langchain_perplexity import ChatPerplexityChat model wrapping the Perplexity API for grounded chat completions.
PerplexitySearchRetrieverRetrieverfrom langchain_perplexity import PerplexitySearchRetrieverRetriever that returns Document objects from the Perplexity Search API.
PerplexitySearchResultsToolfrom langchain_perplexity import PerplexitySearchResultsTool that returns Perplexity Search API results as a JSON array for agents.
PerplexityEmbeddingsEmbeddingsfrom langchain_perplexity import PerplexityEmbeddingsEmbedding model wrapping the Perplexity Embeddings API.