Skip to content

Conversation

@Davidyz
Copy link
Contributor

@Davidyz Davidyz commented Oct 25, 2025

Description

  1. Properly add reasoning parameters in the requests.
  2. handle reasoning output.
  3. use feat(adapters): support extra fields in chat-completion response in OpenAI adapter #2359

Reference: https://ai.google.dev/gemini-api/docs/openai#thinking

Screenshots

image

Checklist

  • I've read the contributing guidelines and have adhered to them in this PR
  • I've added test coverage for this fix/feature
  • I've run make all to ensure docs are generated, tests pass and my formatting is applied
  • (optional) I've updated CodeCompanion.has in the init.lua file for my new feature
  • (optional) I've updated the README and/or relevant docs pages

@Davidyz Davidyz force-pushed the feat/gemini_reasoning branch 3 times, most recently from 63db296 to df03135 Compare October 25, 2025 08:27
"none",
},
default = -1, -- dynamic reasoning
-- TODO: validate requires having `self` in the params.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since different models have different thinking budget, we might need to change validate so that it also accepts self in the parameters (something like validate(self, n) instead of the current validate(n). @olimorris would that be alright?

@Davidyz Davidyz force-pushed the feat/gemini_reasoning branch from bb85994 to 0708fcf Compare October 25, 2025 09:09
@Davidyz Davidyz marked this pull request as ready for review October 25, 2025 12:55
@olimorris olimorris added the P2 Moderate impact, moderate urgency label Oct 25, 2025
@Davidyz
Copy link
Contributor Author

Davidyz commented Oct 25, 2025

Btw, this may also be the culprit behind the Gemini adapter having occasional time out error: it defaults to use dynamic thinking, but the cc adapter didn't request for the reasoning summary and thought it timed out.

Maybe we should increase the default timeout for Gemini adapter or make it configurable?

@Davidyz Davidyz force-pushed the feat/gemini_reasoning branch 2 times, most recently from 9346527 to d51be6e Compare October 29, 2025 02:01
@Davidyz Davidyz force-pushed the feat/gemini_reasoning branch from d51be6e to 4acfc8a Compare October 31, 2025 02:16
@olimorris olimorris added P4 Negligible impact and urgency and removed P2 Moderate impact, moderate urgency labels Nov 2, 2025
@Davidyz Davidyz marked this pull request as draft November 9, 2025 07:23
@Davidyz Davidyz marked this pull request as ready for review November 19, 2025 10:28
@Davidyz
Copy link
Contributor Author

Davidyz commented Nov 19, 2025

The thinking_budget schema currently doesn't validate because the valid value depends on the model, and the current schema implementation doesn't pass self to the validate function.

@Davidyz Davidyz force-pushed the feat/gemini_reasoning branch from be08265 to 8acd7f9 Compare November 25, 2025 06:22
@Davidyz
Copy link
Contributor Author

Davidyz commented Nov 25, 2025

A few things after the gemini-3-pro release:

  1. Gemini-3-pro uses thinking_level ("low" or "high") instead of thinking_budget (integer). I've added the relevant schema, but haven't tested that on a live API.
  2. They seem to have added support for the standard reasoning_effort field from the OpenAI API. It'll be mapped to the appropriate thinking_level or thinking_budget parameter on the server. This doesn't matter for the Gemini 3 model because it's also a string enum, but for the Gemini 2.5 series, we lose the fine control over the number of tokens used for reasoning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P4 Negligible impact and urgency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants