hermes-agent/agent/transports
briandevans cc5b9fb581 fix(transport): omit thinking_config for Gemma on the gemini provider (#17426)
The `gemini` provider also serves Gemma (e.g. `gemma-4-31b-it`) and
historically other Google models like PaLM. Those reject
`extra_body.thinking_config` with HTTP 400:

    Unknown name "thinking_config": Cannot find field

`_build_gemini_thinking_config()` was unconditionally producing a
config dict for any model on the `gemini` / `google-gemini-cli`
provider, which `ChatCompletionsTransport.build_kwargs` then dropped
into `extra_body["thinking_config"]`. The result: every chat turn for
Gemma users on the gemini provider blew up at the API edge.

The fix is the same shape Hermes already uses for the Gemini-2.5 vs
Gemini-3 family clamping: normalise the model id, strip an
`OpenRouter`-style `google/` prefix, and short-circuit early when the
result doesn't start with `gemini`. We return `None` rather than
`{"includeThoughts": False}`, because the API rejects the field name
itself — even the polite "off" form trips the same 400.

Three regression tests cover Gemma with reasoning enabled, Gemma with
reasoning disabled, and the `google/gemma-…` OpenRouter-style id; the
existing Gemini-2.5 / Gemini-3 / `google/gemini-…` cases keep passing
because the Gemini guard fires after the prefix strip.

Fixes #17426

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 04:29:04 -07:00
..
__init__.py fix(agent): preserve Codex message items for replay 2026-04-25 18:22:06 -07:00
anthropic.py fix(anthropic): reactive recovery for OAuth 1M-context beta rejection (#17752) 2026-04-29 21:56:54 -07:00
base.py feat: add transport ABC + AnthropicTransport wired to all paths 2026-04-21 01:27:01 -07:00
bedrock.py feat: add BedrockTransport + wire all Bedrock transport paths 2026-04-21 20:58:37 -07:00
chat_completions.py fix(transport): omit thinking_config for Gemma on the gemini provider (#17426) 2026-04-30 04:29:04 -07:00
codex.py chore: remove unused imports and dead locals (ruff F401, F841) (#17010) 2026-04-28 06:46:45 -07:00
types.py fix(agent): preserve Codex message items for replay 2026-04-25 18:22:06 -07:00