ChatPerplexity
features and configurations head to the API reference.
Overview
Integration details
Class | Package | Local | Serializable | JS support | Downloads | Version |
---|---|---|---|---|---|---|
ChatPerplexity | langchain-perplexity | ❌ | beta | ❌ |
Model features
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|---|
❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ |
Setup
To access Perplexity models you’ll need to create a Perplexity account, get an API key, and install thelangchain-perplexity
integration package.
Credentials
Head to this page to sign up for Perplexity and generate an API key. Once you’ve done this set thePPLX_API_KEY
environment variable:
Using Perplexity-specific parameters through ChatPerplexity
You can also use Perplexity-specific parameters through the ChatPerplexity class. For example, parameters like search_domain_filter, return_images, return_related_questions or search_recency_filter using the extra_body parameter as shown below:
Accessing the search results metadata
Perplexity often provides a list of the web pages it consulted (“search_results”). You don’t need to pass any special parameter — the list is placed inresponse.additional_kwargs["search_results"]
.