feat: add Cerebras LLM plugin with payload optimization#1258
Conversation
Standalone Cerebras plugin with gzip compression and msgpack encoding to reduce TTFT for large prompts.
🦋 Changeset detectedLatest commit: 9323782 The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
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 |
| import type { LLMOptions } from './llm.js'; | ||
| import { LLM } from './llm.js'; | ||
|
|
||
| assert(process.env.CEREBRAS_API_KEY, 'CEREBRAS_API_KEY must be set'); |
There was a problem hiding this comment.
🔴 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
@livekit/agents-plugin-cerebraswith LLM support via the OpenAI-compatible Cerebras APITest plan
pnpm vitest run plugins/cerebras/src/llm.test.ts— 7/7 tests pass (requiresCEREBRAS_API_KEY)