mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-01 13:26:15 +00:00
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 :). |
||
---|---|---|
.. | ||
langchain_perplexity | ||
scripts | ||
tests | ||
.gitignore | ||
LICENSE | ||
Makefile | ||
pyproject.toml | ||
README.md | ||
uv.lock |
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!")