Skip to content

feat: add Cerebras LLM plugin with payload optimization#1258

Merged
u9g merged 2 commits intomainfrom
cerebras-plugin
Apr 15, 2026
Merged

feat: add Cerebras LLM plugin with payload optimization#1258
u9g merged 2 commits intomainfrom
cerebras-plugin

Conversation

@u9g
Copy link
Copy Markdown
Contributor

@u9g u9g commented Apr 15, 2026

Summary

  • Adds @livekit/agents-plugin-cerebras with LLM support via the OpenAI-compatible Cerebras API
  • Supports msgpack encoding and gzip compression for request payloads (docs)
  • Integration tests covering chat, function calling, streaming, and header assertions for all compression modes

Test plan

  • pnpm vitest run plugins/cerebras/src/llm.test.ts — 7/7 tests pass (requires CEREBRAS_API_KEY)

Standalone Cerebras plugin with gzip compression and msgpack encoding
to reduce TTFT for large prompts.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 9323782

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@livekit/agents-plugin-cerebras Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@u9g u9g force-pushed the cerebras-plugin branch from 644561a to a0d4f04 Compare April 15, 2026 17:28
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

import type { LLMOptions } from './llm.js';
import { LLM } from './llm.js';

assert(process.env.CEREBRAS_API_KEY, 'CEREBRAS_API_KEY must be set');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Top-level assert crashes test suite when CEREBRAS_API_KEY is not set

The top-level assert(process.env.CEREBRAS_API_KEY, ...) at line 13 throws during module import if the env var is absent, causing the entire test file to fail. Every other plugin test file in the repo (plugins/openai/src/llm.test.ts, plugins/google/src/llm.test.ts, plugins/deepgram/src/stt.test.ts, etc.) gracefully handles missing API keys by checking Boolean(process.env.XXX_API_KEY) and conditionally skipping tests. Since vitest.config.ts includes all **/*.test.ts files, running pnpm test without CEREBRAS_API_KEY set will report this file as a failure, breaking the test suite for CI and any developer who doesn't have the key configured.

Prompt for agents
Replace the top-level assert with a conditional check that gracefully skips tests when the API key is absent, matching the pattern used by all other plugin test files in the repo.

The established pattern (see plugins/openai/src/llm.test.ts:8-10, plugins/google/src/llm.test.ts:8-10, plugins/deepgram/src/stt.test.ts:9-11) is:

1. Check with: const hasCerebrasApiKey = Boolean(process.env.CEREBRAS_API_KEY);
2. Wrap the describe block in: if (hasCerebrasApiKey) { describe(...) } else { describe('Cerebras', () => { it.skip('requires CEREBRAS_API_KEY', () => {}); }); }

Remove the assert import from vitest and the top-level assert call at line 13. Wrap the entire describe block (lines 106-248) in the conditional.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@u9g u9g force-pushed the cerebras-plugin branch from a0d4f04 to 9323782 Compare April 15, 2026 17:41
@u9g u9g merged commit 1c689ce into main Apr 15, 2026
9 checks passed
@u9g u9g deleted the cerebras-plugin branch April 15, 2026 18:03
@github-actions github-actions Bot mentioned this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants