BetaModelsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

AIProjectClient's

models attribute.

Constructor

BetaModelsOperations(*args, **kwargs)

Methods

create

Register a local model by running the full upload-first sequence.

This wraps the three mandatory steps of the model-registration spec into a single call:

  1. pending_upload — provision a project-managed blob container and obtain a SAS URI.

  2. azcopy copy — upload the local weight files directly to the SAS container.

  3. pending_create_version — finalize registration with the ModelVersion body (blob_uri, weight_type, base_model, description, tags).

delete

Delete the specific version of the ModelVersion. The service returns 200 OK if the ModelVersion was deleted successfully or if the ModelVersion does not exist.

get

Get the specific version of the ModelVersion. The service returns 404 Not Found error if the ModelVersion does not exist.

get_credentials

Get credentials for a model version asset.

list

List the latest version of each ModelVersion.

list_versions

List all versions of the given ModelVersion.

pending_create_version

Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling.

pending_upload

Start or retrieve a pending upload for a model version.

update

Update an existing ModelVersion with the given version id.

create

Register a local model by running the full upload-first sequence.

This wraps the three mandatory steps of the model-registration spec into a single call:

  1. pending_upload — provision a project-managed blob container and obtain a SAS URI.

  2. azcopy copy — upload the local weight files directly to the SAS container.

  3. pending_create_version — finalize registration with the ModelVersion body (blob_uri, weight_type, base_model, description, tags).

create(*, name: str, version: str, source: str | 'os.PathLike[str]', weight_type: str | None = None, base_model: str | None = None, description: str | None = None, tags: 'dict[str, str]' | None = None, azcopy_path: str | None = None, wait_for_commit: Literal[True] = True, polling_timeout: float = 300.0, polling_interval: float = 2.0, **kwargs: Any) -> ModelVersion

Keyword-Only Parameters

Name Description
name
str

Name of the model to register. Required.

version
str

Version identifier for the model. Required.

source

Local file or directory containing the model weights. If a directory, its contents are uploaded recursively to the SAS container root. Required.

weight_type
str

Optional weight type (e.g. "FullWeight", "LoRA", "DraftModel").

Default value: None
base_model
str

Optional base model asset ID.

Default value: None
description
str

Optional asset description.

Default value: None
tags

Optional asset tags.

Default value: None
azcopy_path
str

Optional explicit path to the azcopy executable. Defaults to shutil.which("azcopy").

Default value: None
wait_for_commit

When True (default) poll get until the committed ModelVersion is observable, and return it. When False, return None after the async commit is accepted.

Default value: True
polling_timeout

Total seconds to poll for commit completion.

Default value: 300.0
polling_interval

Seconds between poll attempts.

Default value: 2.0

Returns

Type Description

The committed ModelVersion when wait_for_commit is True, otherwise None.

Exceptions

Type Description

If name version are empty, source does not exist or is empty, polling parameters are non-positive, or the pending-upload response is missing the SAS / blob URI.

If azcopy is not on PATH or exits with a non-zero status, or the registration does not commit before polling_timeout elapses.

delete

Delete the specific version of the ModelVersion. The service returns 200 OK if the ModelVersion was deleted successfully or if the ModelVersion does not exist.

delete(name: str, version: str, **kwargs: Any) -> None

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The version of the ModelVersion to delete. Required.

Returns

Type Description

None

Exceptions

Type Description

get

Get the specific version of the ModelVersion. The service returns 404 Not Found error if the ModelVersion does not exist.

get(name: str, version: str, **kwargs: Any) -> ModelVersion

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The specific version id of the ModelVersion to retrieve. Required.

Returns

Type Description

ModelVersion. The ModelVersion is compatible with MutableMapping

Exceptions

Type Description

get_credentials

Get credentials for a model version asset.

get_credentials(name: str, version: str, credential_request: ModelCredentialRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> DatasetCredential

Parameters

Name Description
name
Required
str

Name of the model. Required.

version
Required
str

Version of the model. Required.

credential_request
Required
ModelCredentialRequest or <xref:JSON> or IO[bytes]

Is one of the following types: ModelCredentialRequest, JSON, IO[bytes] Required.

Returns

Type Description

DatasetCredential. The DatasetCredential is compatible with MutableMapping

Exceptions

Type Description

list

List the latest version of each ModelVersion.

list(**kwargs: Any) -> ItemPaged[ModelVersion]

Returns

Type Description

An iterator like instance of ModelVersion

Exceptions

Type Description

list_versions

List all versions of the given ModelVersion.

list_versions(name: str, **kwargs: Any) -> ItemPaged[ModelVersion]

Parameters

Name Description
name
Required
str

The name of the resource. Required.

Returns

Type Description

An iterator like instance of ModelVersion

Exceptions

Type Description

pending_create_version

Creates a model version asynchronously with blob content validation. Returns 202 Accepted with a Location header for polling.

pending_create_version(name: str, version: str, model_version: ModelVersion | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> CreateAsyncResponse

Parameters

Name Description
name
Required
str

Name of the model. Required.

version
Required
str

Version of the model. Required.

model_version
Required
ModelVersion or <xref:JSON> or IO[bytes]

Model version to create. Is one of the following types: ModelVersion, JSON, IO[bytes] Required.

Returns

Type Description

CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping

Exceptions

Type Description

pending_upload

Start or retrieve a pending upload for a model version.

pending_upload(name: str, version: str, pending_upload_request: ModelPendingUploadRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> ModelPendingUploadResponse

Parameters

Name Description
name
Required
str

Name of the model. Required.

version
Required
str

Version of the model. Required.

pending_upload_request
Required
ModelPendingUploadRequest or <xref:JSON> or IO[bytes]

Is one of the following types: ModelPendingUploadRequest, JSON, IO[bytes] Required.

Returns

Type Description

ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with MutableMapping

Exceptions

Type Description

update

Update an existing ModelVersion with the given version id.

update(name: str, version: str, model_version_update: UpdateModelVersionRequest | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> ModelVersion

Parameters

Name Description
name
Required
str

The name of the resource. Required.

version
Required
str

The specific version id of the UpdateModelVersionRequest to create or update. Required.

model_version_update
Required
UpdateModelVersionRequest or <xref:JSON> or IO[bytes]

The UpdateModelVersionRequest to create or update. Is one of the following types: UpdateModelVersionRequest, JSON, IO[bytes] Required.

Returns

Type Description

ModelVersion. The ModelVersion is compatible with MutableMapping

Exceptions

Type Description