Skip to content

feat: Add native Google Gemini provider support#9

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/add-gemini-provider-support
Open

feat: Add native Google Gemini provider support#9
Copilot wants to merge 3 commits into
mainfrom
copilot/add-gemini-provider-support

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 7, 2026

Gemini models required a manual LiteLLM proxy setup via openai-compatible — undocumented and requiring extra infrastructure. This adds gemini as a first-class provider using the google-genai SDK already present in requirements.txt.

Changes

  • llm_services.py: Added _call_llm_via_gemini() using google.genai.Client directly; routes gemini provider in call_llm(); strips gemini/ litellm prefix from model names; validates response before returning
  • config.py: Added gemini to the provider comment/docstring
  • cli/commands/config.py: Added gemini to --provider click.Choice; added Gemini connectivity test in config validate
  • README.md: Added Gemini to provider list and quick-start example

Usage

codewiki config set \
  --provider gemini \
  --api-key YOUR_GEMINI_API_KEY \
  --main-model gemini-2.5-pro \
  --cluster-model gemini-2.5-pro

Copilot AI and others added 2 commits April 7, 2026 19:08
Agent-Logs-Url: https://github.com/WebCafeTech/AutoCodeWikiAI/sessions/30c65042-5c26-476a-abb0-b986a51d2b9f

Co-authored-by: mukund-gohil-atos <82583411+mukund-gohil-atos@users.noreply.github.com>
Agent-Logs-Url: https://github.com/WebCafeTech/AutoCodeWikiAI/sessions/30c65042-5c26-476a-abb0-b986a51d2b9f

Co-authored-by: mukund-gohil-atos <82583411+mukund-gohil-atos@users.noreply.github.com>
Copilot AI changed the title [WIP] Add native Google Gemini provider support feat: Add native Google Gemini provider support Apr 7, 2026
Copilot AI requested a review from mukund-gohil-atos April 7, 2026 19:10
@mukund-gohil-atos mukund-gohil-atos marked this pull request as ready for review April 7, 2026 19:13
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01d13285e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +568 to +572
elif provider == "gemini":
# Use Google Gemini SDK
from google import genai
gemini_client = genai.Client(api_key=api_key)
list(gemini_client.models.list())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Skip mandatory base URL for Gemini validation

The new Gemini connectivity branch is not reachable for the documented Gemini setup because this command still hard-fails earlier when config.base_url is empty (config_validate step 3 exits at lines 509-512). Since the README example added in this commit configures Gemini without --base-url, users can select --provider gemini but then fail validation (and related configured-state checks) before Gemini-specific API testing runs. Make base-URL validation provider-aware (or set a Gemini default URL) so Gemini configs can pass.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Google Gemini as a first-class LLM provider option across the CLI, backend LLM call routing, and user-facing documentation, aiming to remove the need for an OpenAI-compatible proxy setup for Gemini.

Changes:

  • Added a native Gemini call path in call_llm() via the google-genai SDK.
  • Exposed gemini as a selectable provider in CLI config + added a Gemini connectivity check.
  • Updated docs/config comments to include Gemini in the supported provider list and examples.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
README.md Documents Gemini as a supported provider and adds a Gemini config example.
codewiki/src/config.py Updates provider documentation/comments to include gemini.
codewiki/src/be/llm_services.py Routes provider=gemini to a new _call_llm_via_gemini() implementation using google-genai.
codewiki/cli/commands/config.py Adds gemini to --provider choices and a Gemini connectivity check in config validate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
# Google Gemini
codewiki config set \
--provider gemini \
--api-key YOUR_GEMINI_API_KEY \
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The Gemini quick-start omits --base-url, but the CLI configuration model and config validate currently require base_url to be set (and will error with “Base URL not set” before reaching the Gemini connectivity test). Either update the docs to include a valid Gemini base URL (or explain that an existing base URL must remain set), or adjust configuration/validation logic to make base_url optional when provider=gemini.

Suggested change
--api-key YOUR_GEMINI_API_KEY \
--api-key YOUR_GEMINI_API_KEY \
--base-url https://generativelanguage.googleapis.com \

Copilot uses AI. Check for mistakes.
Comment on lines 179 to +187
if provider in ("bedrock", "anthropic"):
return _call_llm_via_litellm(prompt, config, model, temperature)

if provider == "azure-openai":
return _call_llm_via_azure(prompt, config, model, temperature)

if provider == "gemini":
return _call_llm_via_gemini(prompt, config, model, temperature)

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

call_llm() now routes provider == "gemini" through _call_llm_via_gemini(), but the rest of the backend still constructs pydantic_ai agents via create_fallback_models() which always uses OpenAIModel/OpenAIProvider (i.e., OpenAI-compatible HTTP). With provider=gemini, leaf/agent-driven documentation generation will still attempt OpenAI-style calls (and may fail if llm_base_url isn’t configured). Consider updating model/agent creation to use a Gemini-capable pydantic-ai model/provider when config.provider == "gemini", or refactor the agent path to use the same Gemini SDK call path.

Copilot uses AI. Check for mistakes.
Comment on lines +568 to +572
elif provider == "gemini":
# Use Google Gemini SDK
from google import genai
gemini_client = genai.Client(api_key=api_key)
list(gemini_client.models.list())
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The Gemini connectivity test added here is gated by earlier validation that always requires config.base_url to be set and valid. This makes the Gemini provider UX inconsistent (Gemini doesn’t need a base URL, and the README example omits it) and means a fresh Gemini-only config will fail before reaching this branch. Consider skipping the base-URL-required check when provider == "gemini" (and avoid printing/validating it), or auto-populate a sensible default base URL when users select the Gemini provider.

Copilot uses AI. Check for mistakes.
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.

feat: Add native Google Gemini provider support

3 participants