crewAIInc / crewAIInc/crewAI

[BUG] Gemini native provider: version-less aliases (gemini-flash-latest, gemini-flash-lite-latest, gemini-pro-latest) lose tool support — tools are silently dropped from requests

Open Beginner friendly
#7,636 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
58.8k
Forks
8.5k
Avg merge
1d 15h
Merged PRs (30d)
109

Description

Description

The native Gemini provider derives supports_tools, is_gemini_2_0, and the automatic thinking_config from a version regex — re.search(r"gemini-(\d+(?:\.\d+)?)", model.lower()) in GeminiCompletion._normalize_gemini_fields (lib/crewai/src/crewai/llms/providers/gemini/completion.py:99). The version-less aliases that crewAI lists in its own GEMINI_MODELS table (gemini-flash-latest, gemini-flash-lite-latest, gemini-pro-latest; lib/crewai/src/crewai/llms/constants.py:310-312) contain no digit after gemini-, so the regex never matches and they are treated as pre-1.5 models.

Two user-visible consequences:

  1. _prepare_generation_config only attaches tools if tools and self.supports_tools (line 490), so LLM(model="gemini/gemini-flash-latest").call(messages, tools=[...]) sends a request with no tools at all — the model can never call them.
  2. supports_function_calling() returns False, so an Agent on one of these aliases silently downgrades from native function calling to the ReAct text protocol.

Structured output also takes the legacy response_schema path and thinking is not auto-enabled, unlike the numbered equivalents (e.g. gemini-2.5-flash).

Steps to Reproduce
  1. pip install "crewai[google-genai]" (no API key needed).
  2. Run:
from crewai.llms.providers.gemini.completion import GeminiCompletion
g = GeminiCompletion(model="gemini-flash-latest")
print(g.supports_tools, g.supports_function_calling())
cfg = g._prepare_generation_config(None, [{"type": "function", "function": {"name": "lookup", "description": "d", "parameters": {"type": "object", "properties": {}}}}], None)
print(getattr(cfg, "tools", None))
  1. Compare with GeminiCompletion(model="gemini-2.5-flash").
Expected behavior

The -latest aliases resolve to current 2.5-generation models, so supports_tools / supports_function_calling() are True and the request config contains the tools, exactly as for gemini-2.5-flash.

Screenshots/Code snippets
model                                 supports_tools  supports_fc  tools_sent  thinking_auto
gemini-2.5-flash                      True            True         True        True
gemini-2.0-flash                      True            True         True        False
gemini-flash-latest                   False           False        False       False
gemini-flash-lite-latest              False           False        False       False
gemini-pro-latest                     False           False        False       False
Operating System

Windows 11 (reproduces anywhere; capability detection is offline)

Python Version

3.12 (verified on 3.13.12 as well)

crewAI Version

1.15.22 (also reproduced on main @ 3831e8b)

crewAI Tools Version

n/a (not required)

Virtual Environment

Venv (uv)

Evidence

Script output above: the three aliases report supports_tools=False and omit tools from the GenerateContentConfig, while gemini-2.5-flash includes them. llm.py:474 documents "latest" versions as intended-supported; constants.py:310-312 lists the aliases.

Possible Solution

When the version regex misses, consult an explicit alias map for the version-less aliases (e.g. {"gemini-flash-latest": 2.5, "gemini-flash-lite-latest": 2.5, "gemini-pro-latest": 2.5}) rather than loosening the regex — a "first number anywhere" regex would mis-detect gemini-gemma-2-27b-it (gemma has no function calling) as 2.0. Same class of fix as merged PR #4009 for Anthropic. Happy to open a PR with this plus regression tests.

Additional context

Also affects gemini-robotics-er-1.5-preview and the gemini-live-* ids in the table (out of scope for the minimal fix; can be handled separately). Verified no existing issue/PR covers this (searched supports_tools, alias names, thinking config, and all open PR file lists touching the provider on 2026-09-20). This issue was found and written with AI assistance; please apply the llm-generated label per the contribution policy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/crewai/src/crewai/llms/providers/gemini/completion.py at GeminiCompletion._normalize_gemini_fields and review the alias entries in lib/crewai/src/crewai/llms/constants.py. Reproduce the comparison with gemini-2.5-flash, then add regression coverage for the three -latest aliases. Done means their capability flags and automatic configuration match the expected current-generation behavior and tools remain in the generated config.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.