openai-scala-client icon indicating copy to clipboard operation
openai-scala-client copied to clipboard

Add support for Gemini "thinking budget" configuration

Open yahor-filipchyk opened this issue 5 months ago • 2 comments

I noticed that CreateChatCompletionSettings includes ReasoningEffort, which is an enum. Google's Gemini has a thinkingBudget parameter that can be set to a number. 0 means no thinking. Looks like the default behavior is "dynamic thinking" – Gemini determines how much thinking to do. My main use case would primarily be around switching between no thinking and dynamic thinking.

See Gemini API documentation.

Generally speaking though, I see you have extra_params in CreateChatCompletionSettings which I think is nice. Any way to make that a general-purpose extension where certain "extra" parameters can be mapped to... I don't know, maybe a json object that can be deep-merged with the request body built by the library? Perhaps a similar mapping for adding extra query parameters? Something like this would allow including extra stuff/behavior in the API request that the client Scala code doesn't explicitly support (yet). These model vendors don't seem to try following a common pattern anyway so catching up and maintaining shared abstractions can be challenging

yahor-filipchyk avatar Jun 26 '25 23:06 yahor-filipchyk

Hey @yahor-filipchyk , thanks for the suggestion! I will check the gemini documentation first to determine if some of the thinking/reasoning stuff can be generalized at a higher level.

peterbanda avatar Jul 01 '25 15:07 peterbanda

Gemini API docs have this page where they show how, when Gemini is used via an OpenAI library (not sure which), the reasoning effort maps to the thinking budget. I thought this might be helpful

yahor-filipchyk avatar Jul 14 '25 15:07 yahor-filipchyk