feat: add Google Gemini provider via OpenAI-compatible endpoint#5
Open
anonymort wants to merge 14 commits intoShinMegamiBoson:mainfrom
Open
feat: add Google Gemini provider via OpenAI-compatible endpoint#5anonymort wants to merge 14 commits intoShinMegamiBoson:mainfrom
anonymort wants to merge 14 commits intoShinMegamiBoson:mainfrom
Conversation
Add Apache 2.0 license file, contribution guide with code of conduct, and [project.optional-dependencies] dev group (pytest, mypy, ruff). Update README to reference the new files.
Ruff violations (12 fixed): - N806: Rename _PARALLEL_TOOLS to parallel_tools (engine.py) - B007: Rename unused loop var attempt to _attempt (model.py) - RUF012: Add ClassVar annotation to mutable class attribute (tui.py) - F841: Remove unused fed variable (cast_to_video.py) - C408: Convert dict() calls to dict literals (5 files) - RUF002: Replace × with x in docstring (test_integration.py) - RUF005: Use iterable unpacking instead of concatenation (test_replay_log.py) - RUF059: Prefix unused unpacked variable with underscore (test_settings.py) - RUF015: Replace slice[0] with next() (test_tool_defs.py) Mypy errors (19 fixed): - Add type parameters to untyped dicts (settings.py, builder.py, tools.py) - Add missing return type annotations (tools.py, tui.py) - Fix incompatible type assignments (tools.py, demo.py, builder.py, engine.py) - Fix Generator import from collections.abc (tools.py) - Add TextIO type annotation (tools.py) - Add cast for json.loads return value (runtime.py) - Add type annotations for Rich integration (tui.py) - Remove unused type: ignore comments (tools.py, engine.py, tui.py) - Keep necessary type: ignore for Rich library compatibility (engine.py, tui.py) All checks now pass: - ruff: 0 violations - mypy: 0 errors - pytest: 412 passing tests
Replaces the 260-line if/elif chain in _apply_tool_call with a dict registry pattern. Each stateless tool gets a dedicated _handle_* method; subtask/execute are extracted into _apply_subtask/_apply_execute. Zero behavior change — all argument extraction and validation logic is copied verbatim from the original branches.
Author
|
Again largely vibe coded - caution |
…runtime overrides)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAICompatibleModelpointed at Google's official OpenAI-compatible endpoint (https://generativelanguage.googleapis.com/v1beta/openai) withstrict_tools=FalseOPENPLANTER_GEMINI_API_KEY,GEMINI_API_KEY, andGOOGLE_API_KEYenv var fallback chainFiles Changed
agent/credentials.pygemini_api_keyinCredentialBundle(7 locations); env var priority chainagent/config.pygemini_api_key,gemini_base_urlonAgentConfig;"gemini"inPROVIDER_DEFAULT_MODELSagent/builder.py_GEMINI_RE,infer_provider_for_model,build_model_factory,build_engine, factory guardagent/engine.py_model_tierkeyword mapping;_lowest_tier_modelGemini branch; 5_MODEL_CONTEXT_WINDOWSentriesagent/model.pyEchoFallbackModel.notementions Geminitests/test_gemini.pydocs/plans/2026-02-20-gemini-provider-design.mdHow to Use
Key Design Decisions
strict_tools=False— Google's compat layer doesn't enforce OpenAI strict mode schemas; must be set explicitly in bothbuild_engineandbuild_model_factory"pro"→1,"lite"→3, else→2; version-agnostic sogemini-3-proworks without a code change^gemini-— hyphen required to prevent false matches on hypotheticalgeminimaxetc.GOOGLE_API_KEYfallback — picks up keys already set in Google AI Studio environmentsPre-implementation Opus Review
All findings addressed before writing a line of code. See design doc for full table.
Test Results