Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

Add Google Gemini (google_generative_ai) as a selectable LLM provider so users can list and connect to Google models. Implement listGoogleModels to fetch and parse Google model metadata, register the provider in the shared LLM provider list, wire it into the model selection logic, and create provider connections using @ai-sdk/google in the LLM connection hook. This change enables discovery of Google models, handles generation capability checks and ignore rules, and integrates the provider into the existing UI and connection flow.
v
v
@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 556a200
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/691d183c327fd100087abc7d
😎 Deploy Preview https://deploy-preview-1724--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds Google Generative AI (Google Gemini) as an LLM provider: provider config, model discovery module, common filter updates, wiring into provider selection and language-model connection, and provider-specific UI guidance.

Changes

Cohort / File(s) Change Summary
Provider Configuration
apps/desktop/src/components/settings/ai/llm/shared.tsx
Adds a new provider entry for Google Gemini (id: "google_generative_ai") including displayName, icon, apiKey flag, and baseUrl
Model Discovery & Filtering
apps/desktop/src/components/settings/ai/shared/list-google.ts
New module listGoogleModels(baseUrl, apiKey) that fetches GET {baseUrl}/models with x-goog-api-key, validates model schema, partitions models into included/ignored, handles timeouts/errors, and returns ListModelsResult
Common Filtering Logic
apps/desktop/src/components/settings/ai/shared/list-common.ts
Adds "computer" and "robotics" to commonIgnoreKeywords, affecting model ignore heuristics
Provider-to-Model Mapping
apps/desktop/src/components/settings/ai/llm/select.tsx
Extends provider-to-model mapping to call listGoogleModels(baseUrl, apiKey) for provider id google_generative_ai
Language Model Connection
apps/desktop/src/hooks/useLLMConnection.ts
Adds branch to construct a Google Generative AI provider via createGoogleGenerativeAI (imported from @ai-sdk/google) using tauriFetch, baseURL, and apiKey, wrapped with thinking middleware
Provider UI Guidance
apps/desktop/src/components/settings/ai/llm/configure.tsx
Adds a provider-specific message for google_generative_ai pointing to AI Studio for API key creation

Sequence Diagram(s)

sequenceDiagram
    participant UI as Settings UI
    participant Select as select.tsx
    participant ListGoogle as list-google.ts
    participant GoogleAPI as Google API
    participant Hook as useLLMConnection

    UI->>Select: choose provider google_generative_ai
    Select->>ListGoogle: listGoogleModels(baseUrl, apiKey)
    ListGoogle->>GoogleAPI: GET /models (x-goog-api-key)
    GoogleAPI-->>ListGoogle: models + metadata
    ListGoogle->>ListGoogle: validate schema, strip "models/" prefix, partition/filter
    ListGoogle-->>Select: included / ignored model IDs
    Select-->>UI: render available models
    UI->>Hook: initialize provider google_generative_ai
    Hook->>Hook: createGoogleGenerativeAI(fetch, baseURL, apiKey)
    Hook-->>UI: provider instance (ready)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to apps/desktop/src/components/settings/ai/shared/list-google.ts (Effect pipeline, timeout, schema decoding, error paths).
  • Verify header usage (x-goog-api-key), baseUrl correctness, and model name normalization (removing "models/" prefix).
  • Ensure consistent provider id "google_generative_ai" across shared.tsx, select.tsx, useLLMConnection.ts, and configure.tsx.

Possibly related PRs

  • AI setting custom #1586 — Modifies the PROVIDERS entries and provider-specific UI in shared.tsx/configure.tsx, likely overlapping with provider configuration changes in this PR.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a pull request description explaining the purpose, implementation details, and any relevant context for adding Google Generative AI provider support.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding Google Generative AI provider support, which is reflected across all modified files.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ab6b73 and 556a200.

📒 Files selected for processing (1)
  • apps/desktop/src/components/settings/ai/llm/configure.tsx (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@yujonglee yujonglee merged commit 9387537 into main Nov 19, 2025
6 of 7 checks passed
@yujonglee yujonglee deleted the add-google-gemini-llm-provider branch November 19, 2025 01:07
Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
apps/desktop/src/components/settings/ai/shared/list-common.ts (1)

21-31: Keyword expansion affects all providers’ model filtering

Adding "computer" and "robotics" to commonIgnoreKeywords will now ignore any model id containing these substrings for every provider (not just Google) via shouldIgnoreCommonKeywords. That’s probably what you want for *-computer-use* / robotics-style tool models, but if you hit false positives later, consider narrowing this (e.g. provider‑specific checks or more specific patterns).

apps/desktop/src/components/settings/ai/shared/list-google.ts (1)

1-63: Google model listing implementation is sound; a couple of small nits

This module cleanly follows the existing pattern: typed decode via GoogleModelSchema, shared partition/shouldIgnoreCommonKeywords, and a defensive Effect pipeline with timeout and a DEFAULT_RESULT fallback. The supportsGeneration / getIgnoreReasons logic should correctly filter out non‑generateContent and embedding/robotics models.

Two small, non‑blocking nits:

  • The async on listGoogleModels is redundant since you just return Effect.runPromise(...); you could drop async or add an await for clarity.
  • If you ever need more than the default page size from /models, you may want to add pagination or a pageSize query param, but that’s probably overkill for a simple model picker.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be4f038 and 1ab6b73.

📒 Files selected for processing (5)
  • apps/desktop/src/components/settings/ai/llm/select.tsx (2 hunks)
  • apps/desktop/src/components/settings/ai/llm/shared.tsx (1 hunks)
  • apps/desktop/src/components/settings/ai/shared/list-common.ts (1 hunks)
  • apps/desktop/src/components/settings/ai/shared/list-google.ts (1 hunks)
  • apps/desktop/src/hooks/useLLMConnection.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/desktop/src/components/settings/ai/shared/list-google.ts (1)
apps/desktop/src/components/settings/ai/shared/list-common.ts (7)
  • ListModelsResult (13-16)
  • DEFAULT_RESULT (18-18)
  • ModelIgnoreReason (3-9)
  • shouldIgnoreCommonKeywords (45-48)
  • fetchJson (33-43)
  • partition (50-66)
  • REQUEST_TIMEOUT (19-19)
apps/desktop/src/components/settings/ai/llm/select.tsx (1)
apps/desktop/src/components/settings/ai/shared/list-google.ts (1)
  • listGoogleModels (26-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (macos, macos-14)
  • GitHub Check: fmt
🔇 Additional comments (3)
apps/desktop/src/components/settings/ai/llm/select.tsx (1)

18-18: Google provider is correctly wired into the model listing flow

The listGoogleModels import and the "google_generative_ai" switch case match the patterns used for the other providers and correctly pass (baseUrl, apiKey). This should integrate cleanly with ModelCombobox and the existing useConfiguredMapping behavior.

Also applies to: 237-239

apps/desktop/src/hooks/useLLMConnection.ts (1)

2-2: Google Generative AI branch mirrors other providers

The google_generative_ai path is consistent with Anthropic/OpenAI: you construct the provider via createGoogleGenerativeAI({ fetch, baseURL, apiKey }) and then call googleProvider(conn.modelId) before wrapping with the thinking middleware, which keeps behavior aligned with the other backends. Please just double‑check this matches the expected factory signature and call style for your @ai-sdk/google version.

Also applies to: 80-88

apps/desktop/src/components/settings/ai/llm/shared.tsx (1)

60-68: Google Gemini provider entry looks consistent with the rest of the config

The new "google_generative_ai" provider definition (id, display name, icon, apiKey: true, and requiresPro: false) lines up with how it’s used in useLLMConnection and the model selector. The default base URL points at the v1beta Generative Language API; confirm that this matches the version your @ai-sdk/google setup expects for both listing (/models) and inference.

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.

2 participants