fix: update Gemini model to 2.5-flash and add API auto-detection in enhance

Fix 1 — gemini.py: replace deprecated gemini-2.0-flash-exp (404 errors)
with gemini-2.5-flash (stable, GA, Google's recommended replacement).
Closes #290.

Fix 2 — enhance dispatcher: implement the documented auto-detection that
was missing from the code. skill-seekers enhance now correctly routes:
  - ANTHROPIC_API_KEY set → Claude API mode (enhance_skill.py)
  - GOOGLE_API_KEY set    → Gemini API mode
  - OPENAI_API_KEY set    → OpenAI API mode
  - No API keys           → LOCAL mode (Claude Code Max, free)

Use --mode LOCAL to force local mode even when an API key is present.

9 new tests cover _detect_api_target() priority logic and main()
routing (API delegation, --mode LOCAL override, no-key fallback).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-24 06:52:55 +03:00
parent 63968c05f6
commit 5ae57d192a
3 changed files with 246 additions and 20 deletions

View File

@@ -3,7 +3,7 @@
Google Gemini Adaptor
Implements platform-specific handling for Google Gemini skills.
Uses Gemini Files API for grounding and Gemini 2.0 Flash for enhancement.
Uses Gemini Files API for grounding and Gemini 2.5 Flash for enhancement.
"""
import json
@@ -23,7 +23,7 @@ class GeminiAdaptor(SkillAdaptor):
- Plain markdown format (no YAML frontmatter)
- tar.gz packaging for Gemini Files API
- Upload to Google AI Studio / Files API
- AI enhancement using Gemini 2.0 Flash
- AI enhancement using Gemini 2.5 Flash
"""
PLATFORM = "gemini"
@@ -279,7 +279,7 @@ See the references directory for complete documentation with examples and best p
def supports_enhancement(self) -> bool:
"""
Gemini supports AI enhancement via Gemini 2.0 Flash.
Gemini supports AI enhancement via Gemini 2.5 Flash.
Returns:
True
@@ -288,7 +288,7 @@ See the references directory for complete documentation with examples and best p
def enhance(self, skill_dir: Path, api_key: str) -> bool:
"""
Enhance SKILL.md using Gemini 2.0 Flash API.
Enhance SKILL.md using Gemini 2.5 Flash API.
Args:
skill_dir: Path to skill directory
@@ -338,7 +338,7 @@ See the references directory for complete documentation with examples and best p
try:
genai.configure(api_key=api_key)
model = genai.GenerativeModel("gemini-2.0-flash-exp")
model = genai.GenerativeModel("gemini-2.5-flash")
response = model.generate_content(prompt)