feat(provider) add gemini provider#1507
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands CoPaw's capabilities by integrating Google Gemini as a first-class model provider, allowing users to leverage Google's advanced LLMs directly. Concurrently, it broadens the application's international reach by adding comprehensive Japanese and French localization, making the platform more accessible to a wider user base. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new provider for Google Gemini, including the necessary backend logic, dependency updates, and documentation. It also adds French and Japanese translations for the console and website. The implementation of the Gemini provider is solid, but I've noted a couple of areas for improvement regarding unused parameters and exception handling. Additionally, there are some minor grammatical corrections for the new French translation file.
There was a problem hiding this comment.
Pull request overview
This PR adds Google Gemini as a built-in model provider for CoPaw using the native google-genai SDK, and adds Japanese and French translations for the website and console UI.
Changes:
- Introduces
GeminiProviderclass with model discovery, connection checking, and streaming chat support, integrated into the provider manager and model factory. - Adds
google-genai>=1.67.0as a core dependency inpyproject.toml. - Adds Japanese and French locale translations for the website (i18n, doc titles, docs page routing) and console frontend, plus translated
modelsdocumentation.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/copaw/providers/gemini_provider.py |
New GeminiProvider implementation with connection checks, model fetching, and chat model instantiation |
src/copaw/providers/provider_manager.py |
Registers Gemini as a built-in provider and adds deserialization dispatch |
src/copaw/agents/model_factory.py |
Registers GeminiChatFormatter for GeminiChatModel |
pyproject.toml |
Adds google-genai>=1.67.0 to core dependencies |
website/src/pages/Docs.tsx |
Adds ja/fr doc title translations and updates lang suffix routing |
website/src/i18n.ts |
Adds ja/fr Lang types and full translation records |
console/src/locales/fr.json |
Full French locale for the console UI |
console/src/i18n.ts |
Registers French locale in console i18n |
website/public/docs/models.*.md |
Gemini provider documentation in en/zh/ja/fr |
Comments suppressed due to low confidence (1)
website/src/pages/Docs.tsx:399
- The fallback when a localized doc file is not found fetches
${activeSlug}.md(no language suffix), but doc files in this project are always named with a language suffix (e.g.,intro.en.md,intro.zh.md). Since onlymodels.ja.mdandmodels.fr.mdexist, Japanese and French users will see blank content for every other documentation page (e.g.,intro,quickstart,cli, etc.) because the fallback URLintro.mddoesn't exist either. The fallback should fetch${activeSlug}.en.mdinstead of${activeSlug}.mdto gracefully show English content when a translation is unavailable.
const langSuffix = (["zh", "ja", "fr"] as const).includes(lang as any) ? lang : "en";
const base = (import.meta.env.BASE_URL ?? "/").replace(/\/$/, "") || "";
const url = `${base}/docs/${activeSlug}.${langSuffix}.md`;
fetch(url)
.then((r) => (r.ok ? r.text() : ""))
.then((text) => {
if (cancelled) return;
if (text) {
setContent(text);
return;
}
return fetch(`${base}/docs/${activeSlug}.md`).then((r) =>
r.ok ? r.text() : "",
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add native Gemini support using AgentScope SDK's GeminiChatModel and GeminiChatFormatter. This includes a new GeminiProvider implementation that uses the google-genai SDK, registration in ProviderManager with pre-configured models (Gemini 2.5 Pro/Flash, 2.0 Flash), model factory formatter mapping, and documentation in both English and Chinese. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
- Update Gemini model list to include latest models (3.1 Pro, 3 Flash, 3.1 Flash Lite, 2.5 Pro, 2.5 Flash, 2.5 Flash Lite, 2.0 Flash) - Add French locale (fr.json) for console UI - Add Japanese and French translations for models documentation - Add Japanese and French language support to website i18n and docs routing - Update English and Chinese model docs with latest Gemini model names https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
Adds a `gemini` optional-dependency group (`pip install copaw[gemini]`) and includes it in the `full` extras, matching the pattern used by ollama. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
Move google-genai from optional to base dependencies, matching how OpenAI/Anthropic SDKs are treated. Remove lazy import guard in GeminiProvider and update all docs to remove manual SDK install step. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
Pin to the latest stable release to avoid compatibility issues with older minor versions. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
Apply prettier formatting to website and console files, fix black formatting and pylint unused-argument warning in gemini_provider.py. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
2d338fc to
8c0fc65
Compare
Strip out FR/JA translations (console locale, website docs, website i18n, Docs.tsx routing) to keep this PR focused on the Gemini provider. Locale support can be added in a separate follow-up PR. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
There was a problem hiding this comment.
Pull request overview
This PR adds Google Gemini as a built-in model provider for CoPaw, using the native google-genai SDK. It introduces a GeminiProvider class following the established provider pattern, registers it in the provider manager, adds google-genai as a core dependency, and includes documentation in both English and Chinese. The PR also adds French locale support in i18n.ts and applies minor indentation/formatting fixes to several console components.
Changes:
- New
GeminiProviderclass with model discovery, connection checking, and streaming chat support, plus registration inProviderManagerandmodel_factory.py - Added
google-genai>=1.67.0as a core dependency and English/Chinese documentation for the Gemini provider - Added French locale import in
i18n.tsand minor ternary operator indentation fixes across several console components
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/copaw/providers/gemini_provider.py |
New Gemini provider implementation with connection check, model discovery, and chat model instantiation |
src/copaw/providers/provider_manager.py |
Registers Gemini provider as builtin, adds model list, and deserialization support |
src/copaw/agents/model_factory.py |
Adds GeminiChatModel/GeminiChatFormatter to the formatter map |
pyproject.toml |
Adds google-genai>=1.67.0 as a core dependency |
website/public/docs/models.en.md |
English documentation for Gemini provider setup |
website/public/docs/models.zh.md |
Chinese documentation for Gemini provider setup |
console/src/i18n.ts |
Imports and registers French locale (file missing) |
console/src/layouts/Sidebar.tsx |
Ternary indentation formatting fix |
console/src/components/MarkdownCopy/MarkdownCopy.tsx |
Ternary indentation formatting fix |
console/src/pages/Settings/Models/components/cards/RemoteProviderCard.tsx |
Ternary indentation formatting fix |
console/src/pages/Settings/Models/components/modals/ProviderConfigModal.tsx |
Interface declaration formatting fix |
console/src/pages/Control/Sessions/index.tsx |
Filter callback formatting fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
These are pre-existing prettier issues on main, not introduced by this PR. Reverting to keep the diff focused on the Gemini provider. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
Cover check_connection, fetch_models, check_model_connection, _normalize_models_payload, and update_config using the same monkeypatch/SimpleNamespace patterns as existing provider tests. https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
There was a problem hiding this comment.
Pull request overview
This PR adds Google Gemini as a built-in model provider for CoPaw using the google-genai SDK. It introduces a GeminiProvider class with support for model discovery, connection checking, and streaming chat, along with pre-configured Gemini models and documentation updates.
Changes:
- New
GeminiProviderimplementation with model discovery, connection checking, and chat model instantiation via AgentScope'sGeminiChatModel - Integration into the provider manager, model factory, API router, and
pyproject.toml(core dependency) - English and Chinese documentation for configuring the Gemini provider
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/copaw/providers/gemini_provider.py |
New provider class implementing Gemini API integration |
src/copaw/providers/provider_manager.py |
Registers Gemini as a built-in provider with pre-configured models |
src/copaw/agents/model_factory.py |
Adds GeminiChatModel/GeminiChatFormatter to the model-formatter map |
src/copaw/app/routers/providers.py |
Adds GeminiChatModel to the ChatModelName literal type |
pyproject.toml |
Adds google-genai>=1.67.0 as a core dependency |
tests/unit/providers/test_gemini_provider.py |
Unit tests for the new Gemini provider |
website/public/docs/models.en.md |
English documentation for configuring Google Gemini |
website/public/docs/models.zh.md |
Chinese documentation for configuring Google Gemini |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two issues caused the save to spin indefinitely: 1. generate_content_stream() was not awaited in check_model_connection, causing the async for loop to iterate over a coroutine object 2. The Gemini client was created without a timeout, so network calls could hang forever on unreachable endpoints Pass timeout via HttpOptions (in milliseconds) when creating the client, and add the missing await on generate_content_stream(). https://claude.ai/code/session_01EvXughe7ZQam3dF6w23bE3
- Add `except Exception` fallback to check_connection, fetch_models, and check_model_connection, matching OpenAI/Anthropic provider pattern to handle network errors, DNS failures, and timeouts gracefully - Add 3 unit tests covering the generic exception fallback paths - Fix model names in EN/ZH docs to include "Preview" suffix matching the actual pre-configured model names in provider_manager.py - Auto-format from pre-commit (trailing commas, black) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds Google Gemini as a built-in model provider for CoPaw, using the native google-genai SDK. The implementation follows the established provider pattern (similar to Anthropic and OpenAI providers) with support for connection checking, model discovery, model connection validation, and streaming chat via AgentScope's GeminiChatModel.
Changes:
- New
GeminiProviderclass with full provider lifecycle (connection check, model discovery, model connection check, chat model instantiation), plus pre-configured Gemini model list and registration in the provider manager. - Integration with the model factory for formatter mapping and API router updates for the new
GeminiChatModelliteral type. - Documentation (English and Chinese) and comprehensive unit tests covering all provider methods.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/copaw/providers/gemini_provider.py |
New provider implementation using google-genai SDK |
src/copaw/providers/provider_manager.py |
Registers Gemini models, provider instance, and deserialization support |
src/copaw/agents/model_factory.py |
Adds GeminiChatModel/GeminiChatFormatter to the formatter map |
src/copaw/app/routers/providers.py |
Adds GeminiChatModel to the ChatModelName literal type |
pyproject.toml |
Adds google-genai>=1.67.0 as a core dependency |
tests/unit/providers/test_gemini_provider.py |
Comprehensive tests for all GeminiProvider methods |
website/public/docs/models.en.md |
English documentation for Gemini provider setup |
website/public/docs/models.zh.md |
Chinese documentation for Gemini provider setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add pylint disable comment for protected-access (matching other provider test files) - Use 'raise StopAsyncIteration from exc' for proper exception chaining - Use implicit booleaness for empty list checks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds Google Gemini as a new built-in model provider for CoPaw, using the native google-genai SDK. The implementation follows the established provider pattern (like OpenAI and Anthropic providers) with connection checking, model discovery, model connection verification, and streaming chat support via AgentScope's GeminiChatModel.
Changes:
- New
GeminiProviderclass with full provider lifecycle (connection check, model discovery, model connection check, chat model instantiation) and integration intoProviderManager, model factory, and API router. - Added
google-genai>=1.67.0as a core dependency, with pre-configured models including Gemini 3.1 Pro Preview, Gemini 3 Flash Preview, and several Gemini 2.x models. - English and Chinese documentation updated with Gemini provider setup instructions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/copaw/providers/gemini_provider.py |
New provider implementation using native google-genai SDK |
src/copaw/providers/provider_manager.py |
Registers Gemini as builtin provider with pre-configured models and deserialization support |
src/copaw/agents/model_factory.py |
Adds GeminiChatFormatter/GeminiChatModel to the formatter mapping |
src/copaw/app/routers/providers.py |
Adds GeminiChatModel to the ChatModelName literal type |
tests/unit/providers/test_gemini_provider.py |
Comprehensive tests for all provider methods |
pyproject.toml |
Adds google-genai>=1.67.0 as core dependency |
website/public/docs/models.en.md |
English documentation for Gemini provider setup |
website/public/docs/models.zh.md |
Chinese documentation for Gemini provider setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Increase timeout to 10
Description
Add Google Gemini as a built-in model provider for CoPaw, using the native
google-genaiSDK. This introduces aGeminiProviderwith support for model discovery, connection checking, and streaming chat via AgentScope'sGeminiChatModel. Pre-configured models include Gemini 3.1 Pro, Gemini 3 Flash, Gemini 3.1 Flash Lite, Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.5 Flash Lite, and Gemini 2.0 Flash.Related Issue: N/A
Security Considerations: API keys are handled consistently with existing providers (stored in config, not logged).
Type of Change
Component(s) Affected
Checklist
pre-commit run --all-fileslocally and it passespytestor as relevant) and they passTesting
pip install -e .(google-genai is now a core dependency at >=1.67.0)copaw models config-key gemini)Local Verification Evidence