Skip to content

feat(provider): add fireworks ai#76

Merged
bzp2010 merged 2 commits intomainfrom
bzp/feat-fireworks-provider
May 3, 2026
Merged

feat(provider): add fireworks ai#76
bzp2010 merged 2 commits intomainfrom
bzp/feat-fireworks-provider

Conversation

@bzp2010
Copy link
Copy Markdown
Collaborator

@bzp2010 bzp2010 commented May 3, 2026

Summary by CodeRabbit

  • New Features
    • Added "Fireworks AI" as a selectable provider across the app (configurable API key and optional base URL), with OpenAI-compatible request handling.
    • UI and API now recognize the provider; English and Chinese localizations added so it appears in provider/model forms.

@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: db79aa7f-70ae-44bd-9579-9770f1d05d31

📥 Commits

Reviewing files that changed from the base of the PR and between 541f6f0 and 54fbce7.

📒 Files selected for processing (2)
  • ui/src/i18n/locales/en.json
  • ui/src/i18n/locales/zh-CN.json
✅ Files skipped from review due to trivial changes (1)
  • ui/src/i18n/locales/zh-CN.json

📝 Walkthrough

Walkthrough

Adds a new Fireworks AI provider: schema and config entry, provider implementation with auth and request transforms (chat + embeddings), wiring into provider registry and proxy auth resolution, and UI localization/types updates.

Changes

Fireworks AI Provider

Layer / File(s) Summary
Schema & Type Definitions
src/config/entities/providers-schema.json, src/config/entities/providers.rs
Adds "fireworks-ai" to provider type enum and to the non-Azure allOf conditional; ProviderConfig gains FireworksAi(configs::FireworksAiProviderConfig) variant and provider_type mapping; schema tests include a fireworks-ai case.
Gateway Provider Logic
src/gateway/providers/fireworks.rs
New FireworksAi provider: IDENTIFIER, default base URL, build_auth_headers producing Authorization: Bearer <api_key>, ChatTransform that defaults context_length_exceeded_behavior to "error" when absent, EmbedTransform that strips encoding_format and user, embedding capability exposure, and unit tests for these behaviors.
Provider Module Registration
src/gateway/providers/mod.rs
Adds pub mod fireworks;, re-exports FireworksAi and its config, adds FIREWORKS_AI identifier, and registers the provider in default_provider_registry(); test updated to assert registry contains fireworks-ai.
Proxy Auth Handling
src/proxy/provider.rs
provider_auth_and_base_url() handles ProviderConfig::FireworksAi returning ProviderAuth::ApiKey(config.api_key.clone()) and optional api_base via parse_base_url; tests added/updated to assert auth and base URL.
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 i18n entries added for fireworks-ai; PROVIDER_TYPE_VARIANTS and exported Provider union extended to include { type: 'fireworks-ai'; config: ApiBaseProviderConfig }.
sequenceDiagram
    participant UI as Client (UI)
    participant Proxy as Proxy
    participant Gateway as Gateway Router
    participant Fireworks as FireworksAi Provider
    participant External as Fireworks API

    UI->>Proxy: create request (provider: "fireworks-ai", payload)
    Proxy->>Gateway: resolve provider auth & base_url
    Gateway->>Fireworks: transform chat/embeddings request (auth header, adjust fields)
    Fireworks->>External: send HTTP request (Bearer token, transformed body)
    External-->>Fireworks: respond
    Fireworks-->>Gateway: map/return response
    Gateway-->>Proxy: forward response
    Proxy-->>UI: return response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
E2e Test Quality Review ⚠️ Warning Implementation has correct error handling and scope, but lacks end-to-end tests covering full request-response flow, HTTP interactions, and critical error scenarios including invalid credentials and malformed inputs. Add comprehensive E2E tests using HTTP mocking libraries testing full business flow, invalid inputs, error scenarios, and provider registration verification through the complete request transformation path.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(provider): add fireworks ai' accurately describes the main objective—adding support for a new Fireworks AI provider across the codebase.
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.
Security Check ✅ Passed Fireworks AI provider implementation securely handles API credentials through ProviderAuth enum, properly routes through OpenAI-compatible schema, and avoids logging or serializing secrets.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bzp/feat-fireworks-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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/gateway/providers/fireworks.rs (1)

19-27: ⚡ Quick win

Add doc comments for the new public Fireworks types.

FireworksAiProviderConfig and FireworksAi are public items but currently undocumented.

📝 Proposed fix
 #[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
+/// Provider config for Fireworks AI (OpenAI-compatible API).
 pub struct FireworksAiProviderConfig {
     pub api_key: String,

     #[serde(skip_serializing_if = "Option::is_none")]
     pub api_base: Option<String>,
 }

+/// Fireworks AI provider implementation.
 pub struct FireworksAi;

As per coding guidelines **/*.rs: Use /// for doc comments on public items in Rust.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/gateway/providers/fireworks.rs` around lines 19 - 27, Add /// doc
comments to the public types FireworksAiProviderConfig and FireworksAi: for
FireworksAiProviderConfig document the struct purpose and describe each field
(api_key: required API key; api_base: optional custom base URL and note serde
skip_serializing_if behavior and usage), and add a brief description that the
struct derives Debug, Clone, Serialize, Deserialize, and utoipa::ToSchema; for
FireworksAi add a concise doc comment describing what the provider represents
and any usage/context for consumers. Use triple-slash comments placed
immediately above the struct and pub struct declarations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ui/src/i18n/locales/en.json`:
- Line 226: The locale file is missing the "fireworks-ai" key under
models.form.providers which causes missing labels; add an entry "fireworks-ai":
"Fireworks AI" to the models.form.providers object in the same en.json (matching
the existing label used in providers.form.types) so model screens use the
correct display name.

---

Nitpick comments:
In `@src/gateway/providers/fireworks.rs`:
- Around line 19-27: Add /// doc comments to the public types
FireworksAiProviderConfig and FireworksAi: for FireworksAiProviderConfig
document the struct purpose and describe each field (api_key: required API key;
api_base: optional custom base URL and note serde skip_serializing_if behavior
and usage), and add a brief description that the struct derives Debug, Clone,
Serialize, Deserialize, and utoipa::ToSchema; for FireworksAi add a concise doc
comment describing what the provider represents and any usage/context for
consumers. Use triple-slash comments placed immediately above the struct and pub
struct declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ea7cd54-62d1-4106-a757-ce1e41caa941

📥 Commits

Reviewing files that changed from the base of the PR and between 3381e7a and 541f6f0.

📒 Files selected for processing (8)
  • src/config/entities/providers-schema.json
  • src/config/entities/providers.rs
  • src/gateway/providers/fireworks.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

Comment thread ui/src/i18n/locales/en.json
@bzp2010 bzp2010 merged commit e4c5cfa into main May 3, 2026
3 checks passed
@bzp2010 bzp2010 deleted the bzp/feat-fireworks-provider branch May 3, 2026 10:03
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