-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add Cerebras provider support #3486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Cerebras provider support #3486
Conversation
- Add CerebrasProvider using OpenAI SDK for Cerebras's OpenAI-compatible API - Support for Llama 3.3, Qwen 3, GPT-OSS, and GLM models - Add cerebras optional dependency group - Add documentation with usage examples and UTM tracking
- Simplify documentation with single sync example - Fix test to expect None for unknown models - Add missing newline at end of file - All provider and documentation tests now pass
|
@sebastiand-cerebras Hey Seb, Cerebras is already documented at https://ai.pydantic.dev/models/openai/#cerebras as it uses the In #3089, we're implementing a new Would it be an option to do same thing for Cerebras, implementing support for any Cerebras-specific additions to the chat completions API? PS. We have a private Slack channel with Cerebras; happy to discuss this more there as well |
- Implement CerebrasModel subclassing OpenAIChatModel - Disable web search (Cerebras-specific feature) - Use cerebras-cloud-sdk for official API support - All tests passing (6/6 Cerebras-specific tests)
Implement CerebrasModel and CerebrasProvider using cerebras-cloud-sdk to provide ultra-fast inference powered by Cerebras Wafer-Scale Engine. Key features: - CerebrasModel extends OpenAIChatModel with web search disabled - Custom _completions_create override to handle SDK compatibility: - Filters OMIT and NOT_GIVEN parameters - Removes unsupported web_search_options parameter - Converts Cerebras SDK response to OpenAI ChatCompletion format - CerebrasProvider uses AsyncCerebras client from cerebras-cloud-sdk - Updated KnownModelName with current Cerebras model list
- Changed CerebrasProvider to use AsyncOpenAI instead of AsyncCerebras SDK - Simplified CerebrasModel by removing custom _completions_create override - Updated dependency from cerebras-cloud-sdk to openai package - Follows OpenRouter pattern for consistency - Reduced codebase by ~200 lines while maintaining all functionality - All Cerebras tests passing (5/5) This aligns with Pydantic team's request to use OpenAI-compatible approach and removes the need for a separate SDK dependency.
- Add test for UserError when no API key provided - Add test for passing openai_client directly - Achieves 100% coverage for cerebras.py
|
Thank you so much for your feedback! I did add these:
|
Thank you for reviewing this.