Skip to content

feat(provider): add groq#71

Merged
bzp2010 merged 1 commit intomainfrom
bzp/feat-groq-provider
May 3, 2026
Merged

feat(provider): add groq#71
bzp2010 merged 1 commit intomainfrom
bzp/feat-groq-provider

Conversation

@bzp2010
Copy link
Copy Markdown
Collaborator

@bzp2010 bzp2010 commented May 3, 2026

Summary by CodeRabbit

  • New Features
    • Added Groq as a supported provider.
    • Groq provider configuration now available, accepting API key and optional base URL settings.
    • Extended provider registry to include Groq for seamless integration.
    • Updated UI localization to display Groq as a provider option in English and Chinese languages.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e56917fb-581f-41ba-81da-64537e45db78

📥 Commits

Reviewing files that changed from the base of the PR and between 211b8a2 and 9b56e89.

📒 Files selected for processing (8)
  • src/config/entities/providers-schema.json
  • src/config/entities/providers.rs
  • src/gateway/providers/groq.rs
  • src/gateway/providers/mod.rs
  • src/proxy/provider.rs
  • ui/src/i18n/locales/en.json
  • ui/src/i18n/locales/zh-CN.json
  • ui/src/lib/api/types.ts

📝 Walkthrough

Walkthrough

This PR adds support for the Groq provider across the system by extending the JSON schema with a new "groq" type, implementing a Groq provider gateway handler, integrating it into the provider registry and proxy authentication, and updating UI localization and TypeScript types to recognize the new provider option.

Changes

Groq Provider Integration

Layer / File(s) Summary
Schema & Configuration Types
src/config/entities/providers-schema.json, src/config/entities/providers.rs
JSON schema enum now includes "groq" as a valid provider type and routes it to OpenAI-compatible configuration. ProviderConfig enum gains a Groq variant mapping to GroqProviderConfig.
Gateway Provider Implementation
src/gateway/providers/groq.rs
New Groq provider handler defines identifier, configuration (api_key, optional api_base), and implements ProviderMeta (auth headers, base URL), ChatTransform (request quirks: disables logprobs/logit_bias/top_logprobs, removes message name fields, forces n=1), and ProviderCapabilities.
Provider Registry & Module Exports
src/gateway/providers/mod.rs
Module exports groq submodule and Groq type; identifiers module adds public constant GROQ; default_provider_registry() registers the Groq provider.
Proxy Authentication Handling
src/proxy/provider.rs
provider_auth_and_base_url() function now handles ProviderConfig::Groq by constructing ProviderAuth::ApiKey from config and parsing optional api_base as base URL override.
UI Localization & Types
ui/src/i18n/locales/en.json, ui/src/i18n/locales/zh-CN.json, ui/src/lib/api/types.ts
English and Chinese locale files add "groq": "Groq" entries under model providers and provider types; TypeScript PROVIDER_TYPE_VARIANTS and Provider union type add 'groq' variant with ApiBaseProviderConfig.

Sequence Diagram

sequenceDiagram
    participant Client as Client/UI
    participant Proxy as Proxy<br/>(provider.rs)
    participant Registry as Provider<br/>Registry
    participant Groq as Groq<br/>Provider
    participant GroqAPI as Groq API

    Client->>Proxy: ChatCompletionRequest<br/>(provider_config: Groq)
    Proxy->>Proxy: provider_auth_and_base_url()<br/>Extract ApiKey & api_base
    Proxy->>Registry: Resolve provider by type
    Registry-->>Groq: Return Groq instance
    Proxy->>Groq: build_auth_headers(ProviderAuth)
    Groq-->>Proxy: Authorization: Bearer <api_key>
    Proxy->>Groq: transform_request(ChatCompletionRequest)
    Groq->>Groq: Apply quirks<br/>(disable unsupported params)
    Groq->>Groq: Remove message name fields<br/>Force n=1
    Groq-->>Proxy: Transformed request body
    Proxy->>GroqAPI: POST /openai/v1/chat/completions<br/>(headers + transformed body)
    GroqAPI-->>Proxy: Response
    Proxy-->>Client: Response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Adds a Groq provider implementation following the same pattern as other gateway providers integrated in the system.
  • Updates provider registry and configuration handling in sync with similar provider-addition PRs.
  • Modifies schema, config enums, and provider dispatch logic that may be tested or refined in related provider-support PRs.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Security Check ❌ Error GroqProviderConfig exposes api_key in plaintext through admin API responses without serde redaction attributes. Add #[serde(skip_serializing)] to api_key field or implement separate response DTOs excluding sensitive fields.
E2e Test Quality Review ⚠️ Warning PR adds Groq provider with only unit tests. Custom requirement mandates E2E tests covering full business flow (config validation → auth extraction → gateway transformation → API call). Unit tests alone are insufficient. Add E2E tests validating complete provider flow: valid/invalid credentials, malformed requests, rate limiting, API failures, and full request/response cycle with transformed headers and quirk application.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(provider): add groq' accurately and concisely describes the main change—adding Groq as a new provider to the codebase, which is evidenced across multiple files including schema updates, provider implementations, and UI localizations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bzp/feat-groq-provider

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@bzp2010 bzp2010 merged commit a57cde7 into main May 3, 2026
3 checks passed
@bzp2010 bzp2010 deleted the bzp/feat-groq-provider branch May 3, 2026 04:42
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.

1 participant