本页还没有译文
本页 19 段还没译成한국어,下面显示的是英文原文。Perplexity integrations
还没翻译译自英文(docs.langchain.com)本页 19 段都还没译
Perplexity is the most powerful way to search the internet with unlimited Pro Search, upgraded AI models, unlimited file upload, image generation, and API credits.
Installation and setup
Install the Perplexity integration package for LangChain JavaScript:
npm install @langchain/perplexity @langchain/coreyarn add @langchain/perplexity @langchain/corepnpm add @langchain/perplexity @langchain/coreGet your API key from the Perplexity API key dashboard and set it as the PERPLEXITY_API_KEY environment variable. See the Perplexity getting started guide for more details.
export PERPLEXITY_API_KEY="your-api-key"Chat model
See a usage example.
import { ChatPerplexity } from "@langchain/perplexity";ChatPerplexity can also target the Perplexity Agent API by passing useResponsesApi: true (or by passing tools: [{ type: "web_search" }], which auto-enables it). See Agent API support on the chat page for details and examples.
Retriever
You can use the PerplexitySearchRetriever to fetch web search results from the Perplexity Search API as Document objects in a standard retrieval pipeline.
See a usage example.
import { PerplexitySearchRetriever } from "@langchain/perplexity";Tools
You can use Perplexity as an agent tool to give your agent access to the Perplexity Search API.
See a usage example.
PerplexitySearchResults
A tool that queries the Perplexity Search API and returns a JSON array of results (title, URL, snippet, date, last updated).
import { PerplexitySearchResults } from "@langchain/perplexity";Components reference
| Class | Abstraction | Import path | Description |
|---|---|---|---|
ChatPerplexity | Chat model | import { ChatPerplexity } from "@langchain/perplexity" | Chat model wrapping the Perplexity API for grounded chat completions. |
PerplexitySearchRetriever | Retriever | import { PerplexitySearchRetriever } from "@langchain/perplexity" | Retriever that returns Document objects from the Perplexity Search API. |
PerplexitySearchResults | Tool | import { PerplexitySearchResults } from "@langchain/perplexity" | Tool that returns Perplexity Search API results as a JSON array for agents. |