Skip to content

adds support for gemini API - #339

Open
charchit7 wants to merge 1 commit into
huggingface:mainfrom
charchit7:cs/gemini_support
Open

adds support for gemini API#339
charchit7 wants to merge 1 commit into
huggingface:mainfrom
charchit7:cs/gemini_support

Conversation

@charchit7

@charchit7 charchit7 commented Jun 22, 2026

Copy link
Copy Markdown

What

Adds Google Gemini as a first-class model provider, selectable via the
gemini/<model> (Google AI Studio) and vertex_ai/<model> (Vertex AI) id
prefixes.

Previously any gemini/� id fell through to the HuggingFace router catch-all
and was misrouted (e.g. openai/gemini/�). This wires Gemini through
LiteLLM's native Google adapters instead.

Changes

  • agent/core/llm_params.py: new gemini/ + vertex_ai/ branch in
    _resolve_llm_params. Forwards reasoning_effort as a top-level kwarg,
    which LiteLLM translates into the thinking budget for Gemini 2.5+ thinking
    models. Adds _GEMINI_EFFORTS = {low, medium, high}; minimal normalizes
    to low, and xhigh/max are handled by the existing effort cascade
    (no per-model capability table, consistent with the other providers).
  • agent/core/model_switcher.py: adds gemini/gemini-2.5-pro and
    gemini/gemini-2.5-flash to the /model suggestions, marks gemini/ and
    vertex_ai/ as direct prefixes (skip the HF router catalog lookup), and
    updates the /model help text and is_valid_model_id docstring.
  • tests/unit/test_llm_params.py: 6 new tests â�� effort forwarding,
    vertex_ai/ route, minimal�low normalization, strict-mode rejection of
    unsupported efforts, non-strict effort drop, and that Gemini is not routed
    through the HF router.

Usage

export GEMINI_API_KEY=...            # AI Studio route
ml-intern --model gemini/gemini-2.5-pro
# or, in-session:  /model gemini/gemini-2.5-pro

@lewtun Please review whenever you are free.

@charchit7
charchit7 marked this pull request as draft June 22, 2026 14:15
@charchit7
charchit7 force-pushed the cs/gemini_support branch from 518a977 to 99de9d8 Compare June 22, 2026 14:18
@charchit7
charchit7 marked this pull request as ready for review June 22, 2026 14:20
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