Skip to content

create_dataset async

create_dataset(
    flywheel_arn: ComprehendFlywheelArn,
    dataset_name: ComprehendArnName,
    input_data_config: DatasetInputDataConfig,
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    dataset_type: Optional[DatasetType] = None,
    description: Optional[Description] = None,
    client_request_token: Optional[ClientRequestTokenString] = None,
    tags: Optional[TagList] = None,
) -> CreateDatasetResponse

Creates a dataset to upload training or test data for a model associated with a flywheel. For more information about datasets, see Flywheel overview in the Amazon Comprehend Developer Guide.

Parameters:

  • flywheel_arn (ComprehendFlywheelArn) –

    The Amazon Resource Number (ARN) of the flywheel of the flywheel to receive the data.

  • dataset_name (ComprehendArnName) –

    Name of the dataset.

  • dataset_type (Optional[DatasetType], default: None ) –

    The dataset type. You can specify that the data in a dataset is for training the model or for testing the model.

  • description (Optional[Description], default: None ) –

    Description of the dataset.

  • input_data_config (DatasetInputDataConfig) –

    Information about the input data configuration. The type of input data varies based on the format of the input and whether the data is for a classifier model or an entity recognition model.

  • client_request_token (Optional[ClientRequestTokenString], default: None ) –

    A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.

  • tags (Optional[TagList], default: None ) –

    Tags for the dataset.

Raises:

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • InvalidRequestException –

    The request is invalid.

  • ResourceInUseException –

    The specified resource name is already in use. Use a different name and try your request again.

  • ResourceLimitExceededException –

    The maximum number of resources per account has been exceeded. Review the resources, and then try your request again.

  • ResourceNotFoundException –

    The specified resource ARN was not found. Check the ARN and try your request again.

  • TooManyRequestsException –

    The number of requests exceeds the limit. Resubmit your request later.

  • TooManyTagsException –

    The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_comprehend/_services/async_comprehend.py
async def create_dataset(
    self,
    flywheel_arn: "capo_comprehend.types.comprehend_flywheel_arn.ComprehendFlywheelArn",
    dataset_name: "capo_comprehend.types.comprehend_arn_name.ComprehendArnName",
    input_data_config: "capo_comprehend.types.dataset_input_data_config.DatasetInputDataConfig",
    *,
    config_overrides: Optional[AsyncComprehendClientConfig] = None,
    dataset_type: Optional["capo_comprehend.types.dataset_type.DatasetType"] = None,
    description: Optional["capo_comprehend.types.description.Description"] = None,
    client_request_token: Optional[
        "capo_comprehend.types.client_request_token_string.ClientRequestTokenString"
    ] = None,
    tags: Optional["capo_comprehend.types.tag_list.TagList"] = None,
) -> "capo_comprehend.types.create_dataset_response.CreateDatasetResponse":
    """<p>Creates a dataset to upload training or test data for a model associated with a flywheel. For more information about datasets, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/flywheels-about.html"> Flywheel overview</a> in the <i>Amazon Comprehend Developer Guide</i>.</p>

    Args:
        flywheel_arn: <p>The Amazon Resource Number (ARN) of the flywheel of the flywheel to receive the data.</p>
        dataset_name: <p>Name of the dataset.</p>
        dataset_type: <p>The dataset type. You can specify that the data in a dataset is for training the model or for testing the model.</p>
        description: <p>Description of the dataset.</p>
        input_data_config: <p>Information about the input data configuration. The type of input data varies based on the format of the input and whether the data is for a classifier model or an entity recognition model.</p>
        client_request_token: <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p>
        tags: <p>Tags for the dataset.</p>

    Raises:
        capo_comprehend.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_comprehend.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_comprehend.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource name is already in use. Use a different name and try your request again.</p>
        capo_comprehend.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>The maximum number of resources per account has been exceeded. Review the resources, and then try your request again.</p>
        capo_comprehend.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
        capo_comprehend.errors.too_many_requests_exception.TooManyRequestsException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_comprehend.errors.too_many_tags_exception.TooManyTagsException: <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
        capo_comprehend.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_comprehend.types.create_dataset_request.CreateDatasetRequest]",
    ) -> AsyncOperationResponse[
        "capo_comprehend.types.create_dataset_response.CreateDatasetResponse"
    ]:
        import capo_comprehend._operations.comprehend_20171127.create_dataset

        (
            output,
            http_response,
        ) = await capo_comprehend._operations.comprehend_20171127.create_dataset.async_create_dataset(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDataset")
    )
    input_: capo_comprehend.types.create_dataset_request.CreateDatasetRequest = {
        "flywheel_arn": flywheel_arn,
        "dataset_name": dataset_name,
        "input_data_config": input_data_config,
    }
    if dataset_type is not None:
        input_["dataset_type"] = dataset_type
    if description is not None:
        input_["description"] = description
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if tags is not None:
        input_["tags"] = tags

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