Inference API Deployment Management

list

Lists all deployments in a project.

Return

A list of msgspec structs containing deployment metadata with the following structure:

[Deployment(
    id='deploy_1c144673-c757-40b4-8eeb-d400f0b9b2f9',
    name='My API',
    project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
    artifact_id='artifact_65a7678a91afa7d22455c5ba',
    version_tag='v1.0.0',
    history_versions=[
        DeploymentHistoryVersion(
            version_tag='v1.0.0',
            artifact_id='artifact_65a7678a91afa7d22455c5ba',
            update_date=1705475663570
        )
    ],
    resources=DeploymentResources(
        cpu=4,
        ram=8192,
        GPU_T4=None
    ),
    scaling=DeploymentScaling(
        replicas=1,
        mode='FixedReplicaCount'
    ),
    status=DeploymentStatus(
        overview='Available',
        message='Created service successfully',
        update_data=1705475727032
    ),
    create_date=1705475663570,
    update_date=1705475727051,
    url='https://asia-inference.nip.io/1c144673-c757-40b4-8eeb-d400f0b9b2f9'
)]

Examples

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.deployments.list()

get

Retrieves a specific deployment using the deployment ID.

Parameters

NameTypeDescription
deploy_idstrThe ID of the deployment as a string.

Return

A msgspec struct containing the specific deployment metadata with the following structure:

Deployment(
    id='deploy_1c144673-c757-40b4-8eeb-d400f0b9b2f9',
    name='My API',
    project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
    artifact_id='artifact_65a7678a91afa7d22455c5ba',
    version_tag='v1.0.0',
    history_versions=[
        DeploymentHistoryVersion(
            version_tag='v1.0.0',
            artifact_id='artifact_65a7678a91afa7d22455c5ba',
            update_date=1705475663570
        )
    ],
    resources=DeploymentResources(
        cpu=4,
        ram=8192,
        GPU_T4=None
    ),
    scaling=DeploymentScaling(
        replicas=1,
        mode='FixedReplicaCount'
    ),
    status=DeploymentStatus(
        overview='Available',
        message='Created service successfully',
        update_data=1705475727032
    ),
    create_date=1705475663570,
    update_date=1705475727051,
    url='https://asia-inference.nip.io/1c144673-c757-40b4-8eeb-d400f0b9b2f9'
)

Examples

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.deployments.get("deploy_1c144673-c757-40b4-8eeb-d400f0b9b2f9")

delete

Deletes a specific deployment from the project.

❗️

Deleted deployments are permanently deleted - all information relating to the deployment, including request history and metrics over the active period of the deployment, will be deleted and cannot be recovered. This action cannot be undone, so only delete your deployments when you are absolutely sure.

Parameters

NameTypeDescription
deploy_idstrThe id of the deployment.

Return

A msgspec struct containing the deleted deployment ID and the deletion status with the following structure:

DeleteResponse(deleted=True, id="deploy_30922d5e-b2f6-43dc-b7b4-e29e2c30fb45")

Examples

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")
project.deployments.delete("deploy_30922d5e-b2f6-43dc-b7b4-e29e2c30fb45")

create

Creates a deployment for a specific model using the model ID.

Parameters

NameTypeDescription
deploymentobjectThe configuration metadata of the deployment.

Return

A msgspec struct containing the specific deployment metadata with the following structure:

Deployment(
    id='deploy_1c144673-c757-40b4-8eeb-d400f0b9b2f9',
    name='My API',
    project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
    artifact_id='artifact_65a7678a91afa7d22455c5ba',
    version_tag='v1.0.0',
    history_versions=[
        DeploymentHistoryVersion(
            version_tag='v1.0.0',
            artifact_id='artifact_65a7678a91afa7d22455c5ba',
            update_date=1705475663570
        )
    ],
    resources=DeploymentResources(
        cpu=4,
        ram=8192,
        GPU_T4=None
    ),
    scaling=DeploymentScaling(
        replicas=1,
        mode='FixedReplicaCount'
    ),
    status=DeploymentStatus(
        overview='Creating',
        message='Creating service.',
        update_data=1705475727032
    ),
    create_date=1705475663570,
    update_date=1705475727051,
    url=None
)

Examples

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

project.deployments.create({
    "name": "My First API",
    "artifact_id": "artifact_63fd950a64845427a706d57c",
})

update

Updates a deployment by deployment metadata.

Parameters

NameTypeDescription
deploymentobjectThe configuration metadata of the deployment.

Return

A msgspec struct containing the specific deployment metadata with the following structure:

Deployment(
    id='deploy_1c144673-c757-40b4-8eeb-d400f0b9b2f9',
    name='My First API v2',
    project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
    artifact_id='artifact_65a7678a91afa7d22455c5ba',
    version_tag='v1.0.0',
    history_versions=[DeploymentHistoryVersion(
        version_tag='v1.0.0',
        artifact_id='artifact_65a7678a91afa7d22455c5ba',
        update_date=1705475663570
    )],
    resources=DeploymentResources(
        cpu=4,
        ram=8192,
        GPU_T4=1
    ),
    scaling=DeploymentScaling(
        replicas=1,
        mode='FixedReplicaCount'
    ),
    status=DeploymentStatus(
        overview='Creating',
        message='Creating service',
        update_data=1705475679244
    ),
    create_date=1705475663570,
    update_date=1705477694540,
    url=None
)

Examples

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

datature.deployments.update(
    "deploy_30922d5e-b2f6-43dc-b7b4-e29e2c30fb45",
    {
        "name": "My First API v2",
        "options": {
            "evaluation_threshold": 0.8
        }
        "resources":{
            "GPU_T4":1
        }
    }
)

create_version

Updates a deployment version for a specific artifact using the artifact ID.

Parameters

NameTypeDescription
deploy_idstrThe ID of the deployment as a string.
version_tagstrThe new version tag name of the deployment.
artifact_idstrThe ID of the artifact as a string.

Return

A msgspec struct containing the specific deployment metadata with the following structure:

Deployment(
    id='deploy_1c144673-c757-40b4-8eeb-d400f0b9b2f9',
    name='My API',
    project_id='proj_cd067221d5a6e4007ccbb4afb5966535',
    artifact_id='artifact_65a75d4891afa7d22455c54d',
    version_tag='v2.0.0',
    history_versions=[
        DeploymentHistoryVersion(
            version_tag='v1.0.0',
            artifact_id='artifact_65a7678a91afa7d22455c5ba',
            update_date=1705475663570
        ),
        DeploymentHistoryVersion(
            version_tag='v2.0.0',
            artifact_id='artifact_65a75d4891afa7d22455c54d',
            update_date=1705477973476
        )
    ],
    resources=DeploymentResources(
        cpu=4,
        ram=8192,
        GPU_T4=1
    ),
    scaling=DeploymentScaling(
        replicas=1,
        mode='FixedReplicaCount'
    ),
    status=DeploymentStatus(
        overview='Creating',
        message='Creating service',
        update_data=1705475679244
    ),
    create_date=1705475663570,
    update_date=1705477694540,
    url=None
)

Examples

from datature.nexus import Client

project = Client("5aa41e8ba........").get_project("proj_b705a........")

project.deployments.create_version(
    "deploy_30922d5e-b2f6-43dc-b7b4-e29e2c30fb45",
    "v2.0.0",
    "artifact_63fd950a64845427a706d57d"
)