fix: align wire format for GeminiModel and GeminiCodeAssistModel. - #933
Draft
StarsExpress wants to merge 5 commits into
Draft
fix: align wire format for GeminiModel and GeminiCodeAssistModel.#933StarsExpress wants to merge 5 commits into
GeminiModel and GeminiCodeAssistModel.#933StarsExpress wants to merge 5 commits into
Conversation
Added `gemini_common.py` and corresponding tests.
Also adjusted `test_gemini_code_assist.py::test_build_request_with_tools` assertions to reflect current status.
GeminiModel and GeminiCodeAssistModel.GeminiModel and GeminiCodeAssistModel.
GeminiModel and GeminiCodeAssistModel.GeminiModel and GeminiCodeAssistModel.
StarsExpress
marked this pull request as ready for review
September 11, 2026 16:27
StarsExpress
marked this pull request as draft
September 11, 2026 16:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #461 to consolidate duplicated Gemini wire-format logic between
gemini_model.py::GeminiModelandgemini_code_assist.py::GeminiCodeAssistModel.Changes
Per issue #461's Proposed Extraction, several functions moved into a new
code_puppy/gemini_common.py:1.
_sanitize_schema_for_gemini+_flatten_union_to_object_gemini+generate_tool_call_idPreviously only in
gemini_model.py. Now they are all ingemini_common.pyto get called by methods in eithergemini_model.pyorgemini_common.py, sincegemini_model.pydepends ongemini_common.py.Relationship:
_build_toolscalls_sanitize_schema_for_gemini, which calls_flatten_union_to_object_gemini.2.
_build_toolsGeminiModelandGeminiCodeAssistModel: both emit sanitized schemas under parameters key.3.
_build_generation_configShared by
GeminiModelandGeminiCodeAssistModel: readsModelSettingscorrectly via.get(), asModelSettingsis aTypedDict, not an object with attributes.Additionally handles
thinking_level&thinkingConfig.4.
_parse_candidate_partsGeminiModelandGeminiCodeAssistModel: per-part text/functionCall/thought loop +usageMetadataextraction, per issue's exact scope.Tests
New
tests/test_gemini_common_full_coverage.pycovers shared functions directly, like:Existing
test_gemini_code_assist.pyalso updated where it asserted the old buggy behavior from GeminiCodeAssistModel's drifted usages.For
test_gemini_model_full_coverage.py, since_sanitize_schema_for_gemini+_flatten_union_to_object_gemini+generate_tool_call_idall joinedgemini_common.py, their corresponding tests have moved intotest_gemini_common_full_coverage.py.