Add Perplexity LLM plugin#5610
Conversation
Adds livekit-plugins-perplexity, a thin wrapper around the OpenAI plugin that targets Perplexity's OpenAI-compatible chat completions endpoint (`https://api.perplexity.ai`) with `sonar-pro` as the default model. Every outgoing request carries an `X-Pplx-Integration: livekit-agents/<version>` attribution header so usage from this plugin can be identified upstream. Mirrors the structure of `livekit-plugins-cerebras` / `livekit-plugins-baseten`. Signed-off-by: James Liounis <james.liounis@perplexity.ai>
|
james-pplx seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Devin Review found 1 potential issue.
⚠️ 1 issue in files not directly in the diff
⚠️ Missing perplexity optional dependency in livekit-agents/pyproject.toml (livekit-agents/pyproject.toml:102)
Every other standalone plugin package (cerebras, xai, openai, anthropic, etc.) is registered as an optional dependency in livekit-agents/pyproject.toml:59-124 so users can install via pip install livekit-agents[perplexity]. The PR adds the workspace source in the root pyproject.toml:45 but omits the corresponding perplexity = ["livekit-plugins-perplexity>=1.5.6"] entry in livekit-agents/pyproject.toml. For reference, the cerebras plugin added its entry (cerebras = ["livekit-plugins-cerebras>=1.5.6"] at livekit-agents/pyproject.toml:77) when it was first introduced in its PR.
View 3 additional findings in Devin Review.
tinalenguyen
left a comment
There was a problem hiding this comment.
Hi @james-pplx, thank you for creating this PR! Could you sign the CLA and add the plugin to livekit-agents/pyproject.toml?
Co-authored-by: Tina Nguyen <72938484+tinalenguyen@users.noreply.github.com>
|
@tinalenguyen Are we ok to merge? |
|
Thanks @tinalenguyen, addressed your review comments here.
🤖 Comment from PSI |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| __version__ = "1.5.6" |
There was a problem hiding this comment.
🔴 Version mismatch: plugin is 1.5.6 but livekit-agents optional dependency requires >=1.5.8
The Perplexity plugin version is set to 1.5.6 in livekit-plugins/livekit-plugins-perplexity/livekit/plugins/perplexity/version.py:15, but the optional dependency declared in livekit-agents/pyproject.toml:103 requires livekit-plugins-perplexity>=1.5.8. Since 1.5.6 < 1.5.8, running pip install livekit-agents[perplexity] would fail to resolve the dependency because the published package version would not satisfy the >=1.5.8 constraint. Every other plugin in the repo (except browser and krisp which have their own versioning) is at version 1.5.8, matching the >=1.5.8 requirement pattern.
| __version__ = "1.5.6" | |
| __version__ = "1.5.8" |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds a
livekit-plugins-perplexityplugin that exposes Perplexity's OpenAI-compatible chat completions endpoint as a LiveKit Agents LLM.The plugin is a thin wrapper around
livekit-plugins-openai, mirroring the pattern used bylivekit-plugins-cerebrasandlivekit-plugins-baseten:base_url = https://api.perplexity.aisonar-proPERPLEXITY_API_KEYenv var (or argument)Attribution header
Every outgoing chat request carries
X-Pplx-Integration: livekit-agents/<plugin-version>(forwarded viaextra_headerson the underlying OpenAI client) so usage from the LiveKit integration can be attributed upstream. A unit test asserts this header is configured.Test plan
uv run --package livekit-plugins-perplexity pytest tests/test_plugin_perplexity.py— 4 passeduv run ruff check livekit-plugins/livekit-plugins-perplexity tests/test_plugin_perplexity.py— cleanLLM()instantiates withPERPLEXITY_API_KEYset; raises a clearValueErrorotherwiseLLM().provider == "Perplexity"and_client.base_urlstarts withhttps://api.perplexity.aiThe added tests are pure mocks (no network) and cover: default model, base URL, attribution header, missing-key error, and provider name.
Files
livekit-plugins/livekit-plugins-perplexity/— new package (mirrors cerebras/baseten layout)tests/test_plugin_perplexity.py— unit testspyproject.toml— register new workspace member