Conversation
Preserve max_output_tokens when Python model metadata is deserialized and serialized without changing existing positional construction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Summary
max_output_tokenson the public PythonModelLimitstype.ModelLimitsconstruction.Context
The generated RPC
ModelCapabilitiesLimitsalready carriesmax_output_tokens, butCopilotClient.list_models()converts model metadatathrough the public
ModelLimits.from_dict(), which previously discarded thefield.
The TypeScript public
ModelCapabilitiestype used bylistModels()alreadyincludes
max_output_tokens. This follows the same schema/public-type parityprinciple addressed in #2569, although that PR was motivated by the TypeScript
session-override path while this change fixes Python model-metadata
deserialization.
Compatibility
ModelLimitsalready supports positional construction as:The new field is keyword-only so existing positional arguments retain their
meaning. This follows the compatibility approach used by the SDK's generated
Python dataclasses when fields are added after an established positional API.
Fixes #2798
Testing
max_output_tokensdeserialization and serializationModelLimitsconstruction remains unchangedpytest test_client.py— 154 passedpytest test_legacy_parameters.py— 7 passedruff format --check copilot test_client.pyruff check copilot test_client.pyty check copilot