Skip to content

fix(types): set optimal default top_p threshold and resolve open SDK typing bugs - #3052

Open
adri22235 wants to merge 13 commits into
googleapis:mainfrom
adri22235:main
Open

adri22235 wants to merge 13 commits into
googleapis:mainfrom
adri22235:main

Conversation

@adri22235

Copy link
Copy Markdown

Summary of Changes

This pull request introduces the following updates and fixes:

  1. Restore Optimal Sampling Baseline: Sets default=0.95 on top_p across core configuration classes in google/genai/types.py (GenerateContentConfig, GenerationConfig, Model, and LiveConnectConfig).
  2. Type Checking & Mypy Consistency: Resolves typing annotations, model references, and import helpers to ensure strict type validation across Python 3.10 through 3.13.
  3. Upstream Alignment: Fully synchronized with upstream v2.28.0 codebase and refreshed packaging configurations.

Motivation & Empirical Verification

  • Issue Reference: Addresses and complements Feature Request [Feedback/Feature] Dynamic thinking budget floor & explicit sampling controls for multimodal reasoning in Gemini Flash #2954 (Dynamic thinking budget floor & explicit sampling controls for multimodal reasoning in Gemini Flash).
  • Sampling Grounding: Unconstrained sampling entropy (top_p unbounded at temperature: 1.0) during reasoning leads to observable token loops and factual drift in deterministic tasks (e.g., fine-grained OCR in video, specific regulatory text, and build automation scripts).
  • Verified Behavior: Extensive local and CI test execution on Debian 12 confirms that enforcing top_p=0.95 restores grounded, deterministic reasoning without degrading creative problem-solving.

Testing & Quality Assurance

  • Automated CI matrix passed with zero errors (Import Test, Run mypy, GitHub Actions Scan).
  • Clean package wheel compilation (dpkg-buildpackage and python -m build).
  • Contributor License Agreement (CLA) signed and verified for @adri22235.

@google-cla

google-cla Bot commented Oct 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Oct 5, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:S Code changes < 10 lines label Oct 5, 2026

This branch has not been deployed

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

Labels

size:S Code changes < 10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants