Skip to content

Conversation

@gunpal5
Copy link
Owner

@gunpal5 gunpal5 commented Dec 26, 2025

Summary

  • Add ThinkingLevel enum (LOW, HIGH) to ThinkingConfig for Gemini 3 models
  • Add Gemini3ProPreview and Gemini3FlashPreview model constants
  • Fix Schema.AdditionalProperties causing API errors by adding [JsonIgnore]
  • Add comprehensive integration tests for Gemini 3 thinking features

Changes

New Features

  • ThinkingLevel: Control the depth of model reasoning with ThinkingLevel.LOW or ThinkingLevel.HIGH
  • Gemini 3 Model Constants: Easy access to new Gemini 3 preview models
  • Thought Signature Support: Automatic preservation in function calling workflows

Bug Fixes

  • Fixed additionalProperties causing INVALID_ARGUMENT errors when using function calling

Closes #94, Closes #87

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Gemini 3 Pro Preview and Gemini 3 Flash Preview models with advanced thinking capabilities for enhanced reasoning and function calling.
    • Introduced ThinkingLevel configuration (LOW, HIGH, UNSPECIFIED) for models supporting thinking-enabled generation.
  • Documentation

    • Updated MCP integration guidance with expanded reference materials.
  • Tests

    • Added comprehensive integration and unit tests for Gemini 3 thinking and function-calling workflows.

✏️ Tip: You can customize this high-level summary in your review settings.

Gunpal Jain and others added 4 commits November 8, 2025 14:59
- Deleted `README_old.md` to retire outdated information.
- Updated `README.md` with links to the MCP Integration Guide and examples for better accessibility.
- Add ThinkingLevel enum (THINKING_LEVEL_UNSPECIFIED, LOW, HIGH) to control
  the depth of model reasoning for Gemini 3 and later models
- Add ThinkingLevel property to ThinkingConfig class
- Add Gemini3ProPreview and Gemini3FlashPreview model constants
- Add comprehensive unit tests for ThinkingConfig serialization
- Add unit tests for Part.Thought and Part.ThoughtSignature preservation
- Add integration tests for function calling with thinking features

Fixes #94, #87
- Add tests that verify thought signatures are returned by the API
- Add manual function call test to verify thought signature preservation
- Add tests that inspect response parts for thought and thoughtSignature properties
- Add proper FunctionCallingBehaviour control for inspecting raw responses
- Fix syntax error in unit test
- Add comprehensive integration tests for Gemini 3 ThinkingConfig
- Test thought signatures with function calling
- Test ThinkingLevel (HIGH/LOW) with Gemini 3 models
- Test ChatSession with thinking enabled
- Fix Schema.AdditionalProperties causing API errors by adding [JsonIgnore]
- Update ThinkingLevel tests to use Gemini 3 models (not supported on 2.x)

Closes #94
@gunpal5 gunpal5 merged commit f54af5b into main Dec 26, 2025
1 of 3 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR adds Gemini 3 support with thinking configuration features. Changes include two new model constants (Gemini3ProPreview and Gemini3FlashPreview), a ThinkingLevel enum and property for ThinkingConfig, modification to Schema serialization behavior, comprehensive unit and integration tests for thinking-enabled generation and function calling, updated README guidance, and removal of the legacy README_old.md file.

Changes

Cohort / File(s) Summary
Documentation
README.md, README_old.md
Updated MCP integration guidance in README with explicit bullet-point links; removed legacy README_old.md containing comprehensive Gemini SDK documentation.
Model Constants
src/GenerativeAI/Constants/GoogleAIModels.cs
Added two public string constants: Gemini3ProPreview and Gemini3FlashPreview, each with XML documentation describing advanced thinking features.
Type System Updates
src/GenerativeAI/Types/ContentGeneration/Common/Schema.cs
Changed AdditionalProperties from [JsonPropertyName("additionalProperties")] to [JsonIgnore], excluding this field from serialization with clarifying documentation.
Generation Config
src/GenerativeAI/Types/ContentGeneration/Config/GenerationConfig.cs
Added public ThinkingLevel enum with values THINKING_LEVEL_UNSPECIFIED, LOW, and HIGH; added ThinkingLevel? property to ThinkingConfig.
Unit Tests
tests/GenerativeAI.Tests/Model/Gemini3_ThinkingConfig_Tests.cs
New test class with 12 test methods validating ThinkingConfig serialization/deserialization, ThinkingLevel enum round-tripping, Part and Content thought signature preservation, and Gemini 3 model constant presence.
Integration Tests
tests/GenerativeAI.IntegrationTests/Gemini3_ThinkingConfig_Integration_Tests.cs, tests/GenerativeAI.IntegrationTests/Gemini3_FunctionCalling_Tests.cs
Two comprehensive integration test suites exercising thinking-enabled generation, function calling with thought signatures, chat sessions with thinking context, auto function calling, streaming with thinking, and ThinkingLevel behavior against live Gemini 3 API.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GenerativeModel
    participant GoogleAI as Google AI API
    participant Response as Response Handler

    Client->>GenerativeModel: Request with ThinkingConfig<br/>(IncludeThoughts, ThinkingBudget,<br/>ThinkingLevel)
    
    GenerativeModel->>GoogleAI: Send generation request<br/>with thinking configuration
    
    rect rgb(200, 220, 255)
    Note over GoogleAI: API processes with thinking enabled
    GoogleAI->>GoogleAI: Generate response with<br/>thought content
    end
    
    GoogleAI->>Response: Return response with:<br/>- Thought parts<br/>- ThoughtSignature<br/>- Function call metadata
    
    Response->>Response: Extract and preserve<br/>ThoughtSignature from parts
    
    alt Function Call Present
        Response->>Client: Return function call details<br/>with thought signature intact
        Client->>GenerativeModel: Resend with function result<br/>+ preserved ThoughtSignature
        GenerativeModel->>GoogleAI: Continue conversation<br/>maintaining thought context
    else No Function Call
        Response->>Client: Return complete response<br/>with thoughts and content
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Gemini three hops into the light,
With thoughts so deep and thinking bright!
ThinkingLevel stacked, function calls aligned—
Signatures preserved, a feature refined!
The thinking rabbit hops in delight! 🥕✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/gemini3-thinking-support

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b30ef5c and 7f05376.

📒 Files selected for processing (8)
  • README.md
  • README_old.md
  • src/GenerativeAI/Constants/GoogleAIModels.cs
  • src/GenerativeAI/Types/ContentGeneration/Common/Schema.cs
  • src/GenerativeAI/Types/ContentGeneration/Config/GenerationConfig.cs
  • tests/GenerativeAI.IntegrationTests/Gemini3_FunctionCalling_Tests.cs
  • tests/GenerativeAI.IntegrationTests/Gemini3_ThinkingConfig_Integration_Tests.cs
  • tests/GenerativeAI.Tests/Model/Gemini3_ThinkingConfig_Tests.cs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini 3 Gemini3 - ThinkingConfig, add support for thinking_level

2 participants