Skip to content

describe_model_package async

describe_model_package(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_package_name: Optional[VersionedArnOrName] = None,
    included_data: Optional[IncludedData] = None,
) -> DescribeModelPackageOutput

Returns a description of the specified model package, which is used to create SageMaker models or list them on Amazon Web Services Marketplace.

If you provided a KMS Key ID when you created your model package, you will see the KMS Decrypt API call in your CloudTrail logs when you use this API. To call this operation without requiring kms:Decrypt permission on the customer-managed key, set IncludedData to MetadataOnly; the response is returned with the embedded ModelCard.ModelCardContent field sanitized.

To create models in SageMaker, buyers can subscribe to model packages listed on Amazon Web Services Marketplace.

Parameters:

  • model_package_name (Optional[VersionedArnOrName], default: None ) –

    The name or Amazon Resource Name (ARN) of the model package to describe.

    When you specify a name, the name must have 1 to 63 characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).

  • included_data (Optional[IncludedData], default: None ) –

    Specifies the level of model package data to include in the response. Use this parameter to call DescribeModelPackage on a model package that has an associated model card without requiring kms:Decrypt permission on the customer-managed KMS key associated with the embedded model card.

    • AllData: Returns the full model package response, including the unredacted ModelCard.ModelCardContent. This option requires kms:Decrypt permission on the customer-managed key, if one is associated with the embedded model card. This is the default.

    • MetadataOnly: Returns the full model package response, but with the embedded ModelCard.ModelCardContent sanitized to include only a small set of unencrypted metadata fields. This option does not require kms:Decrypt permission. All other top-level response fields, including InferenceSpecification, ModelMetrics, DriftCheckBaselines, and SecurityConfig, are returned unchanged. For the list of fields preserved within ModelCardContent, see ModelCard.

    If you don't specify a value, SageMaker returns AllData.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def describe_model_package(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_package_name: Optional[
        "capo_sagemaker.types.versioned_arn_or_name.VersionedArnOrName"
    ] = None,
    included_data: Optional[
        "capo_sagemaker.types.included_data.IncludedData"
    ] = None,
) -> (
    "capo_sagemaker.types.describe_model_package_output.DescribeModelPackageOutput"
):
    """<p>Returns a description of the specified model package, which is used to create SageMaker models or list them on Amazon Web Services Marketplace.</p> <important> <p>If you provided a KMS Key ID when you created your model package, you will see the <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html">KMS Decrypt</a> API call in your CloudTrail logs when you use this API. To call this operation without requiring <code>kms:Decrypt</code> permission on the customer-managed key, set <code>IncludedData</code> to <code>MetadataOnly</code>; the response is returned with the embedded <code>ModelCard.ModelCardContent</code> field sanitized.</p> </important> <p>To create models in SageMaker, buyers can subscribe to model packages listed on Amazon Web Services Marketplace.</p>

    Args:
        model_package_name: <p>The name or Amazon Resource Name (ARN) of the model package to describe.</p> <p>When you specify a name, the name must have 1 to 63 characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).</p>
        included_data: <p>Specifies the level of model package data to include in the response. Use this parameter to call <code>DescribeModelPackage</code> on a model package that has an associated model card without requiring <code>kms:Decrypt</code> permission on the customer-managed KMS key associated with the embedded model card.</p> <ul> <li> <p> <code>AllData</code>: Returns the full model package response, including the unredacted <code>ModelCard.ModelCardContent</code>. This option requires <code>kms:Decrypt</code> permission on the customer-managed key, if one is associated with the embedded model card. This is the default.</p> </li> <li> <p> <code>MetadataOnly</code>: Returns the full model package response, but with the embedded <code>ModelCard.ModelCardContent</code> sanitized to include only a small set of unencrypted metadata fields. This option does not require <code>kms:Decrypt</code> permission. All other top-level response fields, including <code>InferenceSpecification</code>, <code>ModelMetrics</code>, <code>DriftCheckBaselines</code>, and <code>SecurityConfig</code>, are returned unchanged. For the list of fields preserved within <code>ModelCardContent</code>, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelPackage.html#sagemaker-DescribeModelPackage-response-ModelCard">ModelCard</a>.</p> </li> </ul> <p>If you don't specify a value, SageMaker returns <code>AllData</code>.</p>

    Raises:
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.describe_model_package_input.DescribeModelPackageInput]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.describe_model_package_output.DescribeModelPackageOutput"
    ]:
        import capo_sagemaker._operations.sage_maker.describe_model_package

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.describe_model_package.async_describe_model_package(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_sagemaker.types.describe_model_package_output.DescribeModelPackageOutput",
    ) -> dict[str, Any]:
        import capo_sagemaker.types.describe_model_package_output

        return capo_sagemaker.types.describe_model_package_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("DescribeModelPackage", redact_output=_redact_output),
    )
    input_: capo_sagemaker.types.describe_model_package_input.DescribeModelPackageInput = {}
    if model_package_name is not None:
        input_["model_package_name"] = model_package_name
    if included_data is not None:
        input_["included_data"] = included_data

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output