1
0
mirror of https://github.com/hwchase17/langchain.git synced 2025-05-01 13:26:15 +00:00
langchain/libs/partners/perplexity
Sydney Runkle 7e926520d5
packaging: remove Python upper bound for langchain and co libs ()
Follow up to https://github.com/langchain-ai/langsmith-sdk/pull/1696,
I've bumped the `langsmith` version where applicable in `uv.lock`.

Type checking problems here because deps have been updated in
`pyproject.toml` and `uv lock` hasn't been run - we should enforce that
in the future - goes with the other dependabot todos :).
2025-04-28 14:44:28 -04:00
..
langchain_perplexity perplexity[patch]: Fix : Handle missing citations attribute in ChatPerplexity () 2025-04-13 09:24:05 -04:00
scripts
tests partners[lint]: run pyupgrade to get code in line with 3.9 standards () 2025-04-11 07:18:44 -04:00
.gitignore
LICENSE
Makefile
pyproject.toml packaging: remove Python upper bound for langchain and co libs () 2025-04-28 14:44:28 -04:00
README.md
uv.lock packaging: remove Python upper bound for langchain and co libs () 2025-04-28 14:44:28 -04:00

langchain-perplexity

This package contains the LangChain integration with Perplexity.

Installation

pip install -U langchain-perplexity

And you should configure your perplexity credentials 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.

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!")