Skip to content

feat: add Cerebras as an AI provider in backend and UI - #50

Open
krishsharma-code wants to merge 4 commits into
HexmosTech:masterfrom
krishsharma-code:feat/add-cerebras-provider
Open

krishsharma-code wants to merge 4 commits into
HexmosTech:masterfrom
krishsharma-code:feat/add-cerebras-provider

Conversation

@krishsharma-code

@krishsharma-code krishsharma-code commented May 26, 2026 •

Copy link
Copy Markdown

Overview

This PR implements the backend connector and frontend UI configuration for adding Cerebras AI as a natively supported provider. Cerebras is OpenAI-compatible, so it correctly routes through the existing OpenAI wrapper factories.

Changes Made

  • Backend (internal/aiconnectors & internal/ai/langchain):
    • Added ProviderCerebras constant and mapped it to createOpenAIModel().
    • Added canonical base URL (https://api.cerebras.ai/v1) to defaults.
    • Set default fallback model to llama3.1-8b and token limit cap to 8000.
  • Frontend (ui/):
    • Updated AIProviders.tsx to add Cerebras in the UI selectable list with placeholders for API keys and auto-populated base URLs.

Related Issue

This PR fulfills the backend implementation required for HexmosTech/git-lrc#79 under GSSoC.


🔍 LiveReview

Auto-approval decisions

Review Decision Reason
#13178 ❌ Not approved Risk score 1.00 is above the cutoff of 0.50; Classification confidence 7 < required 8

⚙️ Customize risk-based approval policy for this repository or your organization.

@shrsv

shrsv commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Can you share a video walkthrough of how the UI looks like @krishsharma-code (so we can give UI flow feedback if any)?

Also if flow overall OK - we also have workflows to run (security, organization, etc) as well - which we will do once flow seems OK. We will also do a manual review once it runs.

@krishsharma-code

krishsharma-code commented May 27, 2026 •

Copy link
Copy Markdown
Author

Uploading Screen Recording 2026-05-27 213028.mp4…

Hey! I have successfully tested the Cerebras provider locally using Docker. The UI correctly auto-fills the default model (llama3.1-8b), and the backend API validation is correctly triggering and catching invalid test keys. Attached the screen recording for reference! I successfully spun up the entire LiveReview stack locally via Docker and tested my Cerebras AI provider implementation. The default model auto-fills perfectly and backend validation is working exactly as expected.

@LinceMathew

Copy link
Copy Markdown
Contributor

hi @krishsharma-code, Thanks for the video demo, btw. Could you please try with a valid API key? Basically we need to make sure the AI review is also working with this Cerebras. Let us know if you have any issues or doubts.

@livereview-agent

Copy link
Copy Markdown

Add Cerebras Provider and Clean Connector Signatures

Overview

Add Cerebras to the popular AI provider catalog with default models and endpoints. Clean up unused context arguments and dead helper functions in backend connector factories.

Technical Highlights

  • ui/src/pages/AIProviders/AIProviders.tsx: Register Cerebras in the provider catalog with base URL https://api.cerebras.ai/v1 and Llama 3 models.
  • internal/aiconnectors/connector.go: Blank out unused context.Context parameters in model factory helpers and remove the unused min function.

Impact

  • Functionality: Users can configure and use Cerebras as an AI provider in the UI.
  • Risk: Low; backend updates only adjust unused parameters and remove dead code.

@livereview-agent livereview-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❌ LiveReview policy: Not approved (blocked at Risk score) · Review #12674

Stage Result Detail
Eligibility ✅ author level 1 >= required 1
Static rules ✅ no blocking rulesets configured
Risk score ❌ Risk score 1.00 (P100) is above the cutoff of 1.00 (P20)
LLM classification ✅ class "logic-change", confidence 9
Final decision ❌ risk: Risk score 1.00 (P100) is above the cutoff of 1.00 (P20)

@livereview-agent

Copy link
Copy Markdown

Add Build Ignore Tags to Standalone Go Programs

Overview

Adds //go:build ignore to standalone main-package scripts, debug tools, examples, and test helpers. Converts the GitLab comment test to an external package. Adds a Cerebras provider entry to the UI and cleans unused code in aiconnectors.

Technical Highlights

  • cmd/test, debug, scripts, tests/examples: Standalone package main files now carry //go:build ignore; excluded from go build ./... and go vet ./..., runnable only via explicit go run &lt;path&gt;.
  • tests/gitlab_comment_test.go: Test package changes from internal to external livereview_test; tests can only use exported API.
  • internal/aiconnectors/connector.go: Unused ctx params renamed to _; dead local min(a,b int) helper removed.
  • ui/src/pages/AIProviders/AIProviders.tsx: popularAIProviders gains Cerebras entry with id, name, URL, icon, placeholders, and models llama3.1-8b / llama3.3-70b.
  • Build flow: Module-wide compilation and vetting no longer include scratch, debug, or example programs.

Impact

  • Functionality: Normal builds skip standalone programs; Cerebras appears in provider setup UI; GitLab comment tests use exported API only.
  • Risk: External test package will fail if tests reference unexported identifiers. Cerebras apiKeyPlaceholder may leak secret material. Excluded programs need explicit go run paths.

url: 'https://cerebras.ai/',
description: 'Lightning fast AI inference with Llama models.',
icon: <Icons.AI />,
apiKeyPlaceholder: 'csk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: critical

The apiKeyPlaceholder value cREDACTED_SECRET is not a mock example like the other providers. It looks like real key material was redacted, or an invalid placeholder was pasted. A placeholder may render in the UI input and could expose/confuse users.

Suggestions:

  1. Replace with a clearly fake example that matches Cerebras key format (e.g. cREDACTED_SECRET).
  2. Verify no real Cerebras API key exists in the file, git history, or bundles; rotate if one leaked.

Comment thread tests/gitlab_comment_test.go Outdated
@@ -1,4 +1,4 @@
package livereview

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: warning

Switching to the external livereview_test package prevents access to unexported identifiers from the package under test. If this test references unexported functions, types, or fields, it will no longer compile.

Suggestions:

  1. Confirm the test only uses exported symbols; otherwise keep package livereview or export the needed members.
  2. Run go test ./tests/... to confirm the build succeeds after the package rename.

@livereview-agent livereview-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❌ LiveReview policy: Not approved (blocked at Risk score) · Review #13178

Stage Result Detail
Eligibility ✅ author level 1 >= required 1
Static rules ✅ no blocking rulesets configured
Risk score ❌ Risk score 1.00 is above the cutoff of 0.50
LLM classification ❌ classification confidence 7 < required 8
Final decision ❌ risk: Risk score 1.00 is above the cutoff of 0.50; llm: classification confidence 7 < required 8

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.

3 participants