Skip to content

Conversation

@kshitij-microsoft
Copy link
Member

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates default deployment template support for models in Azure ML SDK and adds informational messaging when deploying models with configured deployment templates. The changes include:

  1. Adding defaultDeploymentTemplate field to Model entities with proper serialization
  2. Creating new DefaultDeploymentTemplate class for managing deployment template references
  3. Updating deployment operations to check for and inform users about default deployment templates
  4. Modifying REST client code generation for proper field naming (camelCase in JSON)
  5. Updating swagger configuration and auto-generated REST client operations

Key Changes

  • New DefaultDeploymentTemplate entity class with schema support
  • Model entity extended with default_deployment_template field
  • Deployment operations enhanced to display informational messages about default deployment templates
  • Sample file demonstrating usage patterns
  • Swagger configuration updated with new API version (v2025-04-01-preview)
  • REST client operations auto-regenerated with style improvements

Reviewed changes

Copilot reviewed 45 out of 47 changed files in this pull request and generated no comments.

Show a summary per file
File Description
swagger/.../readme.md Updated swagger configuration, fixed tag conditions, added v2025-04-01-preview
swagger/.../mfe.json Changed field name from DefaultDeploymentTemplate to defaultDeploymentTemplate (camelCase)
samples/model_with_deployment_template_example.py Example code demonstrating DefaultDeploymentTemplate usage (contains hardcoded credentials)
operations/_online_deployment_operations.py Added credential parameter to upload_dependencies call
operations/_model_operations.py Updated return type and imports for v2021_10_01_dataplanepreview models
operations/_deployment_template_operations.py Temporarily changed endpoint to test environment
operations/_batch_deployment_operations.py Added credential parameter to upload_dependencies call
entities/.../default_deployment_template.py New entity class for deployment template references
entities/.../model.py Added default_deployment_template field with serialization support
entities/init.py Exported DefaultDeploymentTemplate class
_utils/_endpoint_utils.py Added logic to check and log messages about default deployment templates
_schema/assets/model.py Added schema field for default_deployment_template
_schema/assets/default_deployment_template.py New schema for DefaultDeploymentTemplate
_restclient/v2021_10_01_dataplanepreview/operations/*.py Auto-generated REST client operations with style improvements

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure-ai-ml

@jayesh-tanna
Copy link
Member

Please update changelog

@jayesh-tanna
Copy link
Member

Please update samples as per code change. this sample code will be published in the ms public documentation: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml/samples

@jayesh-tanna
Copy link
Member

consider to add/update test cases wherever possible

# If we can't fetch the model, continue without the check
pass
except Exception: # pylint: disable=broad-except
# If parsing fails, continue without the check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really long method. can you refactor this


def upload_dependencies(deployment: Deployment, orchestrators: OperationOrchestrator) -> None:
def upload_dependencies(
deployment: Deployment, orchestrators: OperationOrchestrator, credential: Optional[Any] = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of Optional[Any] consider to use Optional[TokenCredential]

match = re.match(REGISTRY_VERSION_PATTERN, deployment.model, re.IGNORECASE)
if match:
registry_name = match.group(1) # Extract registry name from URI
# asset_type = match.group(2) # e.g., "models"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if its comment then can we remove this?

model_version = match.group(4)

try:
# Use the v2021_10_01_dataplanepreview REST client to query the registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why such comment required

service_client_10_2021_dataplanepreview, # service_client with correct base_url
resource_group_name, # resource_group_name
_, # subscription_id (not needed)
_, # service_model_client (not needed here)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz correct the comments here also

)

# Check if model from registry has default_deployment_template
if credential and deployment.model and is_registry_id_for_resource(deployment.model):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider to add test case for this long added code

properties=self.properties,
flavors=(
{key: FlavorData(data=dict(value)) for key, value in self.flavors.items()} if self.flavors else None
), # flatten OrderedDict to dict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove such comment

return model

def _to_rest_object(self) -> ModelVersion:
def _to_rest_object(self) -> Union[ModelVersionData, ModelVersion]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there test case available for this method? if not , should we add one as we have added business logic

name=name, workspace_name=self._workspace_name, **self._scope_kwargs
return self._model_container_operation.get(name=name, registry_name=self._registry_name, **self._scope_kwargs)

def _get_with_workspace(self, name: str, version: Optional[str] = None) -> ModelVersion: # name:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider to add or update test case for this method

)

def _get(self, name: str, version: Optional[str] = None) -> ModelVersion: # name:latest
def _get_with_registry(self, name: str, version: Optional[str] = None) -> ModelVersionData: # name:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider to add or update test case for this method

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants