Skip to content

feat(cerebras): integrate Cerebras cloud SDK for native completion su…#5735

Open
lorenzejay wants to merge 1 commit intomainfrom
lorenze/feat/cerebras-native-provider
Open

feat(cerebras): integrate Cerebras cloud SDK for native completion su…#5735
lorenzejay wants to merge 1 commit intomainfrom
lorenze/feat/cerebras-native-provider

Conversation

@lorenzejay
Copy link
Copy Markdown
Collaborator

@lorenzejay lorenzejay commented May 6, 2026

…pport

  • Added support for the Cerebras cloud SDK, enabling native chat completions.
  • Introduced class for handling requests to the Cerebras API.
  • Updated to include as a dependency.
  • Added tests for the new Cerebras provider, including unit tests and VCR tests for API interactions.
  • Updated existing files to accommodate the new provider and its configurations.

Note

Medium Risk
Introduces a new native LLM provider with its own request/streaming/tool-calling logic plus a new third-party SDK dependency, which could affect routing and runtime behavior for cerebras/* models. Risk is moderated by added unit + VCR coverage and keeping LiteLLM/OpenAI-compatible fallback behavior.

Overview
Adds a native cerebras provider backed by cerebras-cloud-sdk, enabling direct chat.completions calls (sync/async, streaming with usage, tool calling, and structured output validation) via the new CerebrasCompletion implementation.

Updates the LLM factory routing to return CerebrasCompletion for provider="cerebras" or cerebras/<model> prefixes (while still allowing an OpenAI-compatible fallback when the SDK extra isn’t installed), and introduces CEREBRAS_MODELS constants for model validation.

Wires a new optional extra crewai[cerebras] (and lockfile updates) and adds unit + VCR replay tests/cassettes covering basic completion, streaming, and parameter passthrough (e.g., temperature, seed).

Reviewed by Cursor Bugbot for commit b27ab32. Bugbot is set up for automated code reviews on this repo. Configure here.

…pport

- Added support for the Cerebras cloud SDK, enabling native chat completions.
- Introduced  class for handling requests to the Cerebras API.
- Updated  to include  as a dependency.
- Added tests for the new Cerebras provider, including unit tests and VCR tests for API interactions.
- Updated existing files to accommodate the new provider and its configurations.
try:
self._client = self._build_sync_client()
self._async_client = self._build_async_client()
except ValueError:
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b27ab32. Configure here.

)
raise e from e

return content
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Async non-streaming path missing after_llm_call hooks invocation

Medium Severity

The _ahandle_completion (async non-streaming) method is missing the _invoke_after_llm_call_hooks call that exists in the equivalent sync path _handle_completion (line 532-534), the sync streaming path (line 706), and the async streaming path (line 987). This means registered after_llm_call hooks silently won't fire when using the async non-streaming code path.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b27ab32. Configure here.

CerebrasCompletion,
)

return CerebrasCompletion
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cerebras import lacks fallback when SDK missing

High Severity

The if provider == "cerebras" block in _get_native_provider doesn't wrap the import in a try/except ImportError. When cerebras-cloud-sdk isn't installed, the ImportError propagates uncaught, preventing the intended fallback to OpenAICompatibleCompletion (which still lists "cerebras" at line 623). The corresponding test test_falls_back_to_openai_compat_when_sdk_missing expects graceful degradation that the code doesn't implement.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b27ab32. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant