Skip to main content
This guide will help you getting started with Perplexity chat models. For detailed documentation of all ChatPerplexity features and configurations head to the API reference.

Overview

Integration details

Model features

See the links in the table headers below for guides on how to use specific features. Note that at the time of writing, Perplexity only supports structured outputs on certain usage tiers.

Setup

To access Perplexity models you’ll need to create a Perplexity account, get an API key, and install the @langchain/community integration package.

Credentials

Head to https://perplexity.ai to sign up for Perplexity and generate an API key. Once you’ve done this set the PERPLEXITY_API_KEY environment variable:
If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:

Installation

The LangChain Perplexity integration lives in the @langchain/community package:

Instantiation

Now we can instantiate our model object and generate chat completions:

Invocation


API reference

For detailed documentation of all ChatPerplexity features and configurations head to the API reference.