Skip to content

fix(cerebras): expose max_completion_tokens - #6685

Merged
tinalenguyen merged 2 commits into
livekit:mainfrom
ryanl-cerebras:agent/cerebras-max-completion-tokens
Aug 3, 2026
Merged

fix(cerebras): expose max_completion_tokens#6685
tinalenguyen merged 2 commits into
livekit:mainfrom
ryanl-cerebras:agent/cerebras-max-completion-tokens

Conversation

@ryanl-cerebras

Copy link
Copy Markdown
Contributor

Summary

Expose max_completion_tokens on livekit.plugins.cerebras.LLM and forward it unchanged to the parent OpenAI-compatible implementation.

Why

The parent OpenAI LLM already accepts and forwards max_completion_tokens, but the Cerebras subclass omitted it from its constructor. Users therefore had to use the generic OpenAI-compatible plugin to set a completion-token limit, losing the Cerebras plugin's gzip compression and msgpack encoding.

This change uses the existing NotGivenOr[int] and NOT_GIVEN conventions. When omitted, the request payload is unchanged.

Testing

Added hermetic mocked-transport tests covering:

  • Constructor exposure and sentinel default
  • Request forwarding when supplied
  • Request behavior when omitted
  • Gzip compression and msgpack encoding when the option is supplied

Validation performed:

  • uv run pytest tests/test_plugin_cerebras_request.py --unit -q, 3 passed
  • make check, formatting, Ruff, and mypy all passed
  • Live Cerebras smoke test with gpt-oss-120b, max_completion_tokens=128, gzip, and msgpack passed

@ryanl-cerebras
ryanl-cerebras marked this pull request as ready for review August 3, 2026 19:22
@ryanl-cerebras
ryanl-cerebras requested a review from a team as a code owner August 3, 2026 19:22
devin-ai-integration[bot]

This comment was marked as resolved.

@tinalenguyen
tinalenguyen merged commit 8a6d302 into livekit:main Aug 3, 2026
16 checks passed
@ryanl-cerebras
ryanl-cerebras deleted the agent/cerebras-max-completion-tokens branch August 3, 2026 19:39
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