Skip to content

create_ml_endpoint async

create_ml_endpoint(
    *,
    config_overrides: Optional[AsyncneptunedataClientConfig] = None,
    id: Optional[str] = None,
    ml_model_training_job_id: Optional[str] = None,
    ml_model_transform_job_id: Optional[str] = None,
    update: Optional[bool] = None,
    neptune_iam_role_arn: Optional[str] = None,
    model_name: Optional[str] = None,
    instance_type: Optional[str] = None,
    instance_count: Optional[int] = None,
    volume_encryption_kms_key: Optional[str] = None,
) -> CreateMLEndpointOutput

Creates a new Neptune ML inference endpoint that lets you query one specific model that the model-training process constructed. See Managing inference endpoints using the endpoints command.

When invoking this operation in a Neptune cluster that has IAM authentication enabled, the IAM user or role making the request must have a policy attached that allows the neptune-db:CreateMLEndpoint IAM action in that cluster.

Parameters:

  • id (Optional[str], default: None ) –

    A unique identifier for the new inference endpoint. The default is an autogenerated timestamped name.

  • ml_model_training_job_id (Optional[str], default: None ) –

    The job Id of the completed model-training job that has created the model that the inference endpoint will point to. You must supply either the mlModelTrainingJobId or the mlModelTransformJobId.

  • ml_model_transform_job_id (Optional[str], default: None ) –

    The job Id of the completed model-transform job. You must supply either the mlModelTrainingJobId or the mlModelTransformJobId.

  • update (Optional[bool], default: None ) –

    If set to true, update indicates that this is an update request. The default is false. You must supply either the mlModelTrainingJobId or the mlModelTransformJobId.

  • neptune_iam_role_arn (Optional[str], default: None ) –

    The ARN of an IAM role providing Neptune access to SageMaker and Amazon S3 resources. This must be listed in your DB cluster parameter group or an error will be thrown.

  • model_name (Optional[str], default: None ) –

    Model type for training. By default the Neptune ML model is automatically based on the modelType used in data processing, but you can specify a different model type here. The default is rgcn for heterogeneous graphs and kge for knowledge graphs. The only valid value for heterogeneous graphs is rgcn. Valid values for knowledge graphs are: kge, transe, distmult, and rotate.

  • instance_type (Optional[str], default: None ) –

    The type of Neptune ML instance to use for online servicing. The default is ml.m5.xlarge. Choosing the ML instance for an inference endpoint depends on the task type, the graph size, and your budget.

  • instance_count (Optional[int], default: None ) –

    The minimum number of Amazon EC2 instances to deploy to an endpoint for prediction. The default is 1

  • volume_encryption_kms_key (Optional[str], default: None ) –

    The Amazon Key Management Service (Amazon KMS) key that SageMaker uses to encrypt data on the storage volume attached to the ML compute instances that run the training job. The default is None.

Raises:

Source code in docs_src/capo_neptunedata/_services/async_neptunedata.py
async def create_ml_endpoint(
    self,
    *,
    config_overrides: Optional[AsyncneptunedataClientConfig] = None,
    id: Optional[str] = None,
    ml_model_training_job_id: Optional[str] = None,
    ml_model_transform_job_id: Optional[str] = None,
    update: Optional[bool] = None,
    neptune_iam_role_arn: Optional[str] = None,
    model_name: Optional[str] = None,
    instance_type: Optional[str] = None,
    instance_count: Optional[int] = None,
    volume_encryption_kms_key: Optional[str] = None,
) -> "capo_neptunedata.types.create_ml_endpoint_output.CreateMLEndpointOutput":
    """<p>Creates a new Neptune ML inference endpoint that lets you query one specific model that the model-training process constructed. See <a href="https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-endpoints.html">Managing inference endpoints using the endpoints command</a>.</p> <p>When invoking this operation in a Neptune cluster that has IAM authentication enabled, the IAM user or role making the request must have a policy attached that allows the <a href="https://docs.aws.amazon.com/neptune/latest/userguide/iam-dp-actions.html#createmlendpoint">neptune-db:CreateMLEndpoint</a> IAM action in that cluster.</p>

    Args:
        id: <p>A unique identifier for the new inference endpoint. The default is an autogenerated timestamped name.</p>
        ml_model_training_job_id: <p>The job Id of the completed model-training job that has created the model that the inference endpoint will point to. You must supply either the <code>mlModelTrainingJobId</code> or the <code>mlModelTransformJobId</code>.</p>
        ml_model_transform_job_id: <p>The job Id of the completed model-transform job. You must supply either the <code>mlModelTrainingJobId</code> or the <code>mlModelTransformJobId</code>.</p>
        update: <p>If set to <code>true</code>, <code>update</code> indicates that this is an update request. The default is <code>false</code>. You must supply either the <code>mlModelTrainingJobId</code> or the <code>mlModelTransformJobId</code>.</p>
        neptune_iam_role_arn: <p>The ARN of an IAM role providing Neptune access to SageMaker and Amazon S3 resources. This must be listed in your DB cluster parameter group or an error will be thrown.</p>
        model_name: <p>Model type for training. By default the Neptune ML model is automatically based on the <code>modelType</code> used in data processing, but you can specify a different model type here. The default is <code>rgcn</code> for heterogeneous graphs and <code>kge</code> for knowledge graphs. The only valid value for heterogeneous graphs is <code>rgcn</code>. Valid values for knowledge graphs are: <code>kge</code>, <code>transe</code>, <code>distmult</code>, and <code>rotate</code>.</p>
        instance_type: <p>The type of Neptune ML instance to use for online servicing. The default is <code>ml.m5.xlarge</code>. Choosing the ML instance for an inference endpoint depends on the task type, the graph size, and your budget.</p>
        instance_count: <p>The minimum number of Amazon EC2 instances to deploy to an endpoint for prediction. The default is 1</p>
        volume_encryption_kms_key: <p>The Amazon Key Management Service (Amazon KMS) key that SageMaker uses to encrypt data on the storage volume attached to the ML compute instances that run the training job. The default is None.</p>

    Raises:
        capo_neptunedata.errors.bad_request_exception.BadRequestException: <p>Raised when a request is submitted that cannot be processed.</p>
        capo_neptunedata.errors.client_timeout_exception.ClientTimeoutException: <p>Raised when a request timed out in the client.</p>
        capo_neptunedata.errors.constraint_violation_exception.ConstraintViolationException: <p>Raised when a value in a request field did not satisfy required constraints.</p>
        capo_neptunedata.errors.illegal_argument_exception.IllegalArgumentException: <p>Raised when an argument in a request is not supported.</p>
        capo_neptunedata.errors.invalid_argument_exception.InvalidArgumentException: <p>Raised when an argument in a request has an invalid value.</p>
        capo_neptunedata.errors.invalid_parameter_exception.InvalidParameterException: <p>Raised when a parameter value is not valid.</p>
        capo_neptunedata.errors.missing_parameter_exception.MissingParameterException: <p>Raised when a required parameter is missing.</p>
        capo_neptunedata.errors.ml_resource_not_found_exception.MLResourceNotFoundException: <p>Raised when a specified machine-learning resource could not be found.</p>
        capo_neptunedata.errors.preconditions_failed_exception.PreconditionsFailedException: <p>Raised when a precondition for processing a request is not satisfied.</p>
        capo_neptunedata.errors.too_many_requests_exception.TooManyRequestsException: <p>Raised when the number of requests being processed exceeds the limit.</p>
        capo_neptunedata.errors.unsupported_operation_exception.UnsupportedOperationException: <p>Raised when a request attempts to initiate an operation that is not supported.</p>
        capo_neptunedata.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_neptunedata.types.create_ml_endpoint_input.CreateMLEndpointInput]",
    ) -> AsyncOperationResponse[
        "capo_neptunedata.types.create_ml_endpoint_output.CreateMLEndpointOutput"
    ]:
        import capo_neptunedata._operations.amazon_neptune_dataplane.create_ml_endpoint

        (
            output,
            http_response,
        ) = await capo_neptunedata._operations.amazon_neptune_dataplane.create_ml_endpoint.async_create_ml_endpoint(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateMLEndpoint")
    )
    input_: capo_neptunedata.types.create_ml_endpoint_input.CreateMLEndpointInput = {}
    if id is not None:
        input_["id"] = id
    if ml_model_training_job_id is not None:
        input_["ml_model_training_job_id"] = ml_model_training_job_id
    if ml_model_transform_job_id is not None:
        input_["ml_model_transform_job_id"] = ml_model_transform_job_id
    if update is not None:
        input_["update"] = update
    if neptune_iam_role_arn is not None:
        input_["neptune_iam_role_arn"] = neptune_iam_role_arn
    if model_name is not None:
        input_["model_name"] = model_name
    if instance_type is not None:
        input_["instance_type"] = instance_type
    if instance_count is not None:
        input_["instance_count"] = instance_count
    if volume_encryption_kms_key is not None:
        input_["volume_encryption_kms_key"] = volume_encryption_kms_key

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