Metadata-Version: 2.1
Name: langchain-perplexity
Version: 1.0.0a1
Summary: An integration package connecting Perplexity and LangChain
License: MIT
Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/partners/perplexity
Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-perplexity%3D%3D0%22&expanded=true
Project-URL: repository, https://github.com/langchain-ai/langchain
Requires-Python: <4.0.0,>=3.10.0
Requires-Dist: langchain-core<2.0.0,>=1.0.0a6
Requires-Dist: openai<3.0.0,>=2.0.0
Description-Content-Type: text/markdown

# langchain-perplexity

This package contains the LangChain integration with Perplexity.

## Installation

```bash
pip install -U langchain-perplexity
```

And you should [configure your perplexity credentials](https://docs.perplexity.ai/guides/getting-started)
and then set the `PPLX_API_KEY` environment variable.

## Usage

This package contains the `ChatPerplexity` class, which is the recommended way to interface with Perplexity chat models.

```python
import getpass
import os

if not os.environ.get("PPLX_API_KEY"):
  os.environ["PPLX_API_KEY"] = getpass.getpass("Enter API key for Perplexity: ")

from langchain.chat_models import init_chat_model

llm = init_chat_model("llama-3.1-sonar-small-128k-online", model_provider="perplexity")
llm.invoke("Hello, world!")
```
