Skip to content

Python ModelLimits drops max_output_tokens from model metadata #2798

Description

@mowree

Description

The generated RPC schema includes max_output_tokens in ModelCapabilitiesLimits, but the public Python ModelLimits type does not. CopilotClient.list_models() deserializes model limits through ModelLimits.from_dict(), so the value is discarded.

This follows the same schema/public-type parity principle addressed for TypeScript in #2569, although this issue affects the Python model-list response path rather than the session override path.

Reproduction

from copilot import ModelLimits

limits = ModelLimits.from_dict(
    {
        "max_prompt_tokens": 128000,
        "max_output_tokens": 16384,
        "max_context_window_tokens": 144384,
    }
)

assert limits.max_output_tokens == 16384
assert limits.to_dict()["max_output_tokens"] == 16384

Currently, ModelLimits has no max_output_tokens attribute and to_dict() omits the field.

Expected behavior

ModelLimits should preserve max_output_tokens when deserializing and serializing model metadata.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions