Skip to content

Conversation

@paulb777
Copy link
Member

  • Adds minimal and medium thinking levels expected by Gemini 3
  • Adds integration tests
  • Adds encoding unit tests

One strange note is that adding integration tests for 2.5 succeeds for minimal and medium, but fails for low and high

#no-changelog

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@paulb777
Copy link
Member Author

/gemini summarize

@paulb777
Copy link
Member Author

/gemini review

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request enhances the AI model configuration by adding 'minimal' and 'medium' thinking levels, providing more granular control over the model's reasoning process. It includes new integration tests to verify these levels with the Gemini 3 Flash Preview model and updates encoding unit tests to ensure proper handling of the expanded ThinkingConfig options. The overall aim is to offer greater flexibility in balancing model speed and capability.

Highlights

  • New Thinking Levels: Introduced 'minimal' and 'medium' thinking levels to the ThinkingConfig.ThinkingLevel enum, expanding the options for controlling AI model reasoning.
  • Integration Tests: Added new integration tests specifically for the Gemini 3 Flash Preview model to validate the functionality of the newly implemented 'minimal', 'low', 'medium', and 'high' thinking levels.
  • Encoding Unit Tests: Updated unit tests for GenerationConfig encoding to include comprehensive test cases for ThinkingConfig with the new thinking levels, ensuring correct serialization.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • FirebaseAI/Sources/Types/Public/ThinkingConfig.swift
    • Added minimal and medium cases to the ThinkingLevel.Kind enum.
    • Introduced public static let minimal and public static let medium properties with detailed documentation.
    • Updated documentation for existing low and high thinking levels to clarify their relative performance and use cases.
  • FirebaseAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift
    • Added new test cases for the Gemini 3 Flash Preview model, specifically testing ThinkingConfig with minimal, low, medium, and high thinking levels.
    • Modified the assertion logic to correctly handle thinkingLevel configurations, introducing a minThoughtTokens calculation based on the model name.
  • FirebaseAI/Tests/Unit/GenerationConfigTests.swift
    • Added a new test function testEncodeGenerationConfig_thinkingConfig to validate the JSON encoding of GenerationConfig when ThinkingConfig is present.
    • Included various test cases covering thinkingBudget and the new thinkingLevel options (minimal, low, medium, high), both with and without includeThoughts.
Activity
  • A bot (gemini-code-assist[bot]) provided information about using Gemini Code Assist.
  • The author (paulb777) requested a summary of the pull request using the /gemini summarize command.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces minimal and medium thinking levels for Gemini models, along with corresponding integration and unit tests. The implementation of the new levels is correct. However, I've identified a couple of areas for improvement in the tests. The integration test contains some duplicated code that can be simplified for better readability. More importantly, the new unit tests for encoding ThinkingConfig have incorrect indentation in the expected JSON strings, which would likely cause the tests to fail. I've provided suggestions to fix these issues. Overall, good work on adding the new functionality and tests.

@paulb777 paulb777 requested a review from andrewheard December 26, 2025 21:41
Copy link
Contributor

@andrewheard andrewheard left a comment

Choose a reason for hiding this comment

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

Code changes LGTM but please adjust the medium doc comment.

@andrewheard
Copy link
Contributor

One strange note is that adding integration tests for 2.5 succeeds for minimal and medium, but fails for low and high
-- @paulb777

Extra strange since they should all fail "If you use the thinking_level parameter with a model earlier than Gemini 3, the model returns an error."

@paulb777
Copy link
Member Author

paulb777 commented Jan 5, 2026

One strange note is that adding integration tests for 2.5 succeeds for minimal and medium, but fails for low and high
-- @paulb777

Extra strange since they should all fail "If you use the thinking_level parameter with a model earlier than Gemini 3, the model returns an error."

On gemini2_5_Flash, For thinking_level MEDIUM and MINIMAL, thinking_level is ignored by the backend and generate_content returns successfully.

For thinking_level LOW and HIGH:
"detail": "[ORIGINAL ERROR] generic::invalid_argument: com.google.net.rpc3.client.RpcClientException: \u003ceye3 title='/GenerativeServiceV1beta1.GenerateContent, INVALID_ARGUMENT'/\u003e APPLICATION_ERROR;google.ai.generativelanguage.v1beta/GenerativeServiceV1beta1.GenerateContent;Thinking level is not supported for this model.;AppErrorCode=3;StartTimeMs=1767648840796;unknown;Deadline(sec)=3600.0;ResFormat=uncompressed;ServerTimeSec=0.145686223;LogBytes=256;Non-FailFast;EffSecLevel=none;ReqFormat=uncompressed;ReqID=405e681c333ac351;GlobalID=0;Server=[2002:a05:6359:2701:b0:263:c202:b3b3]:4001 [google.rpc.error_details_ext] { message: "Thinking level is not supported for this model." details { type_url: "type.googleapis.com/language_labs.genai.debug.GeminiApiDebugInfo" value: "\222\001^\n/**Thinking level is not supported for this model.**\022+apiserving/util/error_status_utils.cc:109:0

@paulb777
Copy link
Member Author

paulb777 commented Jan 5, 2026

Merging here. Any additional followup can be addressed in #15557

@paulb777 paulb777 merged commit 8631e58 into ah/ai-thinking-levels Jan 5, 2026
58 checks passed
@paulb777 paulb777 deleted the pb-thinking-levels branch January 5, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants