[azure-ai-ml] Forward list_view_type for registry model-version listing in MLClient.models.list#47179
Draft
Copilot wants to merge 3 commits into
Draft
[azure-ai-ml] Forward list_view_type for registry model-version listing in MLClient.models.list#47179Copilot wants to merge 3 commits into
list_view_type for registry model-version listing in MLClient.models.list#47179Copilot wants to merge 3 commits into
Conversation
Co-authored-by: lavakumarrepala <221403938+lavakumarrepala@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix registry model listing to respect list_view_type argument
[azure-ai-ml] Forward May 27, 2026
list_view_type for registry model-version listing in MLClient.models.list
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.
MLClient.models.list(name=..., list_view_type=...)was droppinglist_view_typewhen scoped to a registry, so registry model filtering (ActiveOnly/ArchivedOnly/All) did not work even though the 2021-10 dataplane client supportslistViewType. This PR wires the missing argument through the operations layer without changing API version or method signatures.Operations fix (registry
namebranch)ModelOperations.listinazure/ai/ml/operations/_model_operations.pyto passlist_view_typetoself._model_versions_operation.list(...)whenregistry_nameis set.stageon registry-scoped version listing.Unit test coverage (workspace + registry parity)
tests/model/unittests/test_model_operations.pywith a focused test asserting:name,registry_name,list_view_typename,workspace_name,list_view_type,stagestageChangelog
Bugs Fixedentry under the current unreleased section insdk/ml/azure-ai-ml/CHANGELOG.mddescribing the registrylist_view_typefix.Original prompt
Summary
In
azure-ai-ml,MLClient.models.list(name=..., list_view_type=...)silently ignores thelist_view_typeargument when the client is scoped to a registry (i.e.MLClient(..., registry_name=...)). As a result, customers cannot filter registry models byActiveOnly/ArchivedOnly/All.The underlying generated REST client for the
2021-10-01-dataplanepreviewAPI version does accept and serializelist_view_typeinto the?listViewType=query parameter (seebuild_list_requestinsdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2021_10_01_dataplanepreview/operations/_model_versions_operations.py). The bug is purely in the operations layer not forwarding the kwarg.No API version upgrade is required to fix this customer-visible bug.
Root cause
File:
sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.pyIn the
listmethod, the workspace branch forwardslist_view_typebut the registry branch does not:The container-level branch right below already forwards
list_view_typecorrectly in both arms; only thename-based versions branch is broken.Required change
In
sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.py, insideModelOperations.list, passlist_view_type=list_view_typeto the registry-branch call:Notes / constraints:
stageon the registry branch — the 2021-10 dataplanemodel_versions.listsignature does not accept it. Current behavior (silently ignored on registries) is preserved._model_operations.pyexists underazure/ai/ml/operations/orazure/ai/ml/_operations/, apply the same fix there for parity.ModelOperations.list.Tests
Add (or extend) a unit test under
sdk/ml/azure-ai-ml/tests/model/that:ModelOperationsinstance withregistry_nameset, using a mockservice_clientwhosemodel_versions.listis aMagicMock.ops.list(name="my-model", list_view_type=ListViewType.ARCHIVED_ONLY)and iterates it.service_client.model_versions.listwas called withlist_view_type=ListViewType.ARCHIVED_ONLY(andregistry_name=...,name="my-model").list_view_typeandstage.Look at neighboring tests (e.g. existing model ops tests) for the established mocking pattern in this package.
Changelog
Add an entry under the next unreleased version in
sdk/ml/azure-ai-ml/CHANGELOG.mdunder Bugs Fixed:Validation
From
sdk/ml/azure-ai-ml:pip install -e .azpysdk pylint .andazpysdk mypy .and ensure no new warnings/errors are introduced by the change.Out of scope
2021-10-01-dataplanepreview. (The newer2023-04-01-preview/2025-01-01-previewRegistryModelVersionsOperations.listalso acceptlist_view_type, but switching API versions is a larger change and is not required to unblock the reported customer scenario.)_model_container_operation.list(...)— it already forwardslist_view_typecorrectly.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ListViewType Not Filtering Models in SDK V2
We are unable to fetch models bas...
This pull request was created from Copilot chat.