翻篇收录说明
翻篇网页快照

Perplexity LLM plugin guide | LiveKit Documentation

https://docs.livekit.io/agents/models/llm/perplexity/

最近抓取:2026-12-05 02:17:52(北京时间)

最近内容变化:2026-12-02 13:42:56(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

How to use Perplexity LLM with LiveKit Agents.

正文摘录

Available inPython|Node.jsOverviewThis plugin allows you to use Perplexity as an LLM provider for your voice agents. Python uses a dedicated livekit-plugins-perplexity package, and Node.js uses Perplexity through the OpenAI plugin.The Python package provides two LLM surfaces: chat completions (perplexity.LLM()) for search-augmented chat, and the Agent API (perplexity.responses.LLM()) for tool-calling agents. Node.js supports chat completions only.InstallationInstall the plugin:PythonNode.jsuv add "livekit-agents[perplexity]~=1.8"pnpm add @livekit/agents-plugin-openai@1.xSet the following environment variable in your .env.local file:PERPLEXITY_API_KEY=<your-perplexity-api-key>Chat completions Use perplexity.LLM() for Perplexity's search-augmented chat completions. This is the simpler choice when your agent doesn't need to call tools.PythonNode.jsfrom livekit.plugins import perplexity session = AgentSession( llm=perplexity.LLM( model="sonar-pro", ), # ... tts, stt, vad, turn_handling, etc.)import * as openai from '@livekit/agents-plugin-openai'; const session = new voice.AgentSession({ llm: openai.LLM.withPerplexity({ model: "sonar-pro", }), // ... tts, stt, vad, turnHandling, etc.});OpenAI plugin alternative (Python)If you already have the OpenAI plugin installed, you can use openai.LLM.with_perplexity() as an alternative. It remains supported, but the dedicated perplexity.LLM() is the recommended path for new code.Parameters This section describes some of the available parameters. For a complete reference of all available parameters, see the plugin reference links in the Additional resources section.modelstr | PerplexityChatModelsDefault: sonar-proModel to use for inference. To learn more, see supported models .temperaturefloatDefault: 1.0Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.Valid values are between 0 and 2.parallel_tool_callsboolControls whether the model can make multiple tool calls in parallel. When enabled, the model can make multiple tool calls simultaneously, which can improve performance for complex tasks.tool_choiceToolChoice | Literal['auto', 'required', 'none']Default: autoControls how the model uses tools. String options are as follows:'auto': Let the model decide.'required': Force tool usage.'none': Disable tool usage.Agent API ONLY Available inPythonperplexity.responses.LLM() targets Perplexity's Agent API . It supports custom function tools along with Perplexity's built-in tools, presets, and reasoning controls.from livekit.plugins import perplexity session = AgentSession( llm=perplexity.responses.LLM( model="perplexity/sonar", ), # ... tts, stt, vad, turn_handling, etc.)Parameters This section describes some of the available parameters. For a complete reference of all available parameters, see the plugin reference links in the Additional resources section.modelstr | PerplexityResponsesModelsDefault: perplexity/sonarModel to use for inference. To learn more, see the Agent API models page.temperaturefloatDefault: 1.0Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.Valid values are between 0 and 2.parallel_tool_callsboolControls whether the model can make multiple tool calls in parallel. When enabled, the model can make multiple tool calls simultaneously, which can improve performance for complex tasks.tool_choiceToolChoice | Literal['auto', 'required', 'none']Default: autoControls how the model uses tools. String options are as follows:'auto': Let the model decide.'required': Force tool usage.'none': Disable tool usage.Additional resources The following links provide more information about the Perplexity LLM integration.Python pluginReferenceGitHubPyPINode.js pluginReferenceGitHubNPMPerplexity docsPerplexity API documentation.Voice AI quickstartGet started with LiveKit Agents and Perplexity.On this pageOverviewInstallationChat completions Parameters Agent API Parameters Additional resources