fix(providers/gmi): post-salvage review fixes

- config.py: remove dead ENV_VARS_BY_VERSION[17] entry (current _config_version
  is 22, so all users are past version 17 and would never be prompted for
  GMI_API_KEY on upgrade — consistent with how arcee was added)
- auxiliary_client.py: use google/gemini-3.1-flash-lite-preview as GMI aux
  model instead of anthropic/claude-opus-4.6 (matches cheap fast-model pattern
  used by all other providers: zai→glm-4.5-flash, kimi→kimi-k2-turbo-preview,
  stepfun→step-3.5-flash, kilocode→google/gemini-3-flash-preview)
- test_gmi_provider.py: fix malformed write_text() call in doctor test
  (was: write_text("GMI_API_KEY=*** encoding="utf-8") → missing closing quote,
  wrote literal string 'GMI_API_KEY=*** encoding=' to .env file)
- test_gmi_provider.py + test_auxiliary_client.py: update aux model assertions
  to match new cheaper default
- docs/integrations/providers.md: add 'gmi' to inline 'Supported providers'
  fallback list (was only in the table, not the inline list at line ~1181)
- docs/reference/cli-commands.md: add 'gmi' to --provider choices list
This commit is contained in:
kshitijk4poor
2026-04-27 23:46:05 +05:30
committed by kshitij
parent c53fcb0173
commit 56724147ef
6 changed files with 16 additions and 45 deletions

View File

@@ -64,7 +64,7 @@ class TestGmiAliases:
class TestGmiConfigRegistry:
def test_optional_env_vars_include_gmi(self):
from hermes_cli.config import ENV_VARS_BY_VERSION, OPTIONAL_ENV_VARS
from hermes_cli.config import OPTIONAL_ENV_VARS
assert "GMI_API_KEY" in OPTIONAL_ENV_VARS
assert OPTIONAL_ENV_VARS["GMI_API_KEY"]["category"] == "provider"
@@ -74,9 +74,9 @@ class TestGmiConfigRegistry:
assert "GMI_BASE_URL" in OPTIONAL_ENV_VARS
assert OPTIONAL_ENV_VARS["GMI_BASE_URL"]["category"] == "provider"
assert OPTIONAL_ENV_VARS["GMI_BASE_URL"]["password"] is False
assert "GMI_API_KEY" in ENV_VARS_BY_VERSION[17]
assert "GMI_BASE_URL" in ENV_VARS_BY_VERSION[17]
# ENV_VARS_BY_VERSION entries are not needed for providers added after
# _config_version 22 (the current baseline) — users discover GMI via
# hermes model, not via upgrade prompts.
class TestGmiModelCatalog:
@@ -158,7 +158,7 @@ class TestGmiDoctor:
home = tmp_path / ".hermes"
home.mkdir(parents=True, exist_ok=True)
(home / "config.yaml").write_text("memory: {}\n", encoding="utf-8")
(home / ".env").write_text("GMI_API_KEY=gmi-test-key\n", encoding="utf-8")
(home / ".env").write_text("GMI_API_KEY=***\n", encoding="utf-8")
project = tmp_path / "project"
project.mkdir(exist_ok=True)
@@ -271,7 +271,7 @@ class TestGmiAuxiliary:
def test_aux_default_model(self):
from agent.auxiliary_client import _API_KEY_PROVIDER_AUX_MODELS
assert _API_KEY_PROVIDER_AUX_MODELS["gmi"] == "anthropic/claude-opus-4.6"
assert _API_KEY_PROVIDER_AUX_MODELS["gmi"] == "google/gemini-3.1-flash-lite-preview"
def test_resolve_provider_client_uses_gmi_aux_default(self, monkeypatch):
monkeypatch.setenv("GMI_API_KEY", "gmi-test-key")
@@ -281,7 +281,7 @@ class TestGmiAuxiliary:
client, model = resolve_provider_client("gmi")
assert client is not None
assert model == "anthropic/claude-opus-4.6"
assert model == "google/gemini-3.1-flash-lite-preview"
assert mock_openai.call_args.kwargs["api_key"] == "gmi-test-key"
assert mock_openai.call_args.kwargs["base_url"] == "https://api.gmi-serving.com/v1"
@@ -293,7 +293,7 @@ class TestGmiAuxiliary:
client, model = resolve_provider_client("gmi-cloud")
assert client is not None
assert model == "anthropic/claude-opus-4.6"
assert model == "google/gemini-3.1-flash-lite-preview"
class TestGmiMainFlow: