KG-561 Add Gemini 3 Pro Preview#1236
Conversation
3237a96 to
82e674c
Compare
82e674c to
8ac25bd
Compare
aozherelyeva
left a comment
There was a problem hiding this comment.
Thank you! Here are some comments regarding the testing part.
| maxTokens = 256 | ||
| ) | ||
| is LLMProvider.Google -> { | ||
| val thinkingConfig = if (model.id.contains("gemini-3")) { |
There was a problem hiding this comment.
It's better to use the variable storing model ID: if (model.id == GoogleModels.Gemini3_Pro_Preview.id)
| fun googleModels(): Stream<LLModel> { | ||
| return Stream.of( | ||
| GoogleModels.Gemini3_Pro_Preview, | ||
| GoogleModels.Gemini2_5Pro, |
There was a problem hiding this comment.
Let's not add Gemini 3 to the googleModels until it's a preview? We can add it a bit later when it's more stable :)
| return Stream.of( | ||
| OpenAIModels.Chat.GPT5_1, | ||
| AnthropicModels.Haiku_4_5, | ||
| GoogleModels.Gemini2_5Pro, |
There was a problem hiding this comment.
Could you please remove GoogleModels.Gemini2_5Pro? I'd suggest having one model from each family to avoid too much time on high-level tests.
0530d45 to
e3b6257
Compare
|
Thanks for the feedback! No problem, only concern I have is that by removing gemini-2.5 from the |
e3b6257 to
a1b6986
Compare
That's a fair point, thank you! Let's not remove the Gemini 2.5 then 😅 |
EugeneTheDev
left a comment
There was a problem hiding this comment.
Looks good, can you rebase please?
28d044d to
e368e53
Compare
|
No problem. Rebased and added back |
e368e53 to
f04e8c1
Compare
|
Man, these tests have been keeping me on my toes lately! 😅 I find myself having to squash/unsquash updates a few times on almost every PR just to rerun the pipeline until it passes. Do we have a ticket tracking this flakiness? |
|
Yes, sorry about that, this is a known problem, and I'm disabling these flaky tests for now until we resolve the flakiness. Hopefully after #1251 it should be stable again |
Discussed and resolved all comments
## Motivation and Context This PR adds support for Google's latest model, **Gemini 3 Pro Preview** (`gemini-3-pro-preview`). While integrating this model, significant changes were required in how "Thinking" (Reasoning) is configured compared to previous versions (Gemini 2.5): * **Thinking Configuration:** Gemini 3 abandons the token-based limit (`thinkingBudget`) in favor of abstract levels (`thinkingLevel`). Currently, `LOW` and `HIGH` are supported. * **Validation Logic:** The `GoogleThinkingConfig` has been updated to support these levels. An `init` block was added to enforce mutual exclusion: users cannot configure both a `thinkingBudget` (legacy/Gemini 2) and a `thinkingLevel` (Gemini 3) simultaneously. * **Conversation Consistency:** Gemini 3 is stricter regarding conversation history; it will fail if thought signatures are not reproduced correctly in subsequent requests. To verify these changes: * **Unit Tests:** Added tests to `ThinkingConfigTest` to verify the JSON serialization of the new `thinkingLevel` and to ensure the mutual exclusion validation works as expected. * **Integration Tests:** The new model was added to `reasoningCapableModels`. Crucially, this runs it against `integration_testReasoningMultiStep`. This validates that multi-turn conversations maintain the correct thought signatures/context, preventing the API failures specific to Gemini 3 when history is mishandled. ## Breaking Changes No breaking changes. The new configuration parameters are optional and specifically targeted at the new model. Existing configurations for Gemini 2 or other providers remain unaffected. --- #### Type of the changes - [x] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Tests improvement - [ ] Refactoring #### Checklist - [x] The pull request has a description of the proposed change - [x] I read the [Contributing Guidelines](https://github.com/JetBrains/koog/blob/main/CONTRIBUTING.md) before opening the pull request - [x] The pull request uses **`develop`** as the base branch - [x] Tests for the changes have been added - [x] All new and existing tests passed ##### Additional steps for pull requests adding a new feature - [x] An issue describing the proposed change exists - [x] The pull request includes a link to the issue - [x] The change was discussed and approved in the issue - [ ] Docs have been added / updated --------- Co-authored-by: Malte Heuser <malte.heuser@ing.com>
Motivation and Context
This PR adds support for Google's latest model, Gemini 3 Pro Preview (
gemini-3-pro-preview).While integrating this model, significant changes were required in how "Thinking" (Reasoning) is configured compared to previous versions (Gemini 2.5):
thinkingBudget) in favor of abstract levels (thinkingLevel). Currently,LOWandHIGHare supported.GoogleThinkingConfighas been updated to support these levels. Aninitblock was added to enforce mutual exclusion: users cannot configure both athinkingBudget(legacy/Gemini 2) and athinkingLevel(Gemini 3) simultaneously.To verify these changes:
ThinkingConfigTestto verify the JSON serialization of the newthinkingLeveland to ensure the mutual exclusion validation works as expected.reasoningCapableModels. Crucially, this runs it againstintegration_testReasoningMultiStep. This validates that multi-turn conversations maintain the correct thought signatures/context, preventing the API failures specific to Gemini 3 when history is mishandled.Breaking Changes
No breaking changes. The new configuration parameters are optional and specifically targeted at the new model. Existing configurations for Gemini 2 or other providers remain unaffected.
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature