AutoMlClient

AutoMlClient

AutoML Server API.

The resource names are assigned by the server. The server never reuses names that it has created after the resources with those names are deleted.

An ID of a resource is the last element of the item's resource name. For projects/{project_id}/locations/{location_id}/datasets/{dataset_id}, then the id for the item is {dataset_id}.

Currently the only supported location_id is "us-central1".

On any input that is documented to expect a string parameter in snake_case or kebab-case, either of those cases is accepted.

Constructor

new AutoMlClient(optionsopt)

Construct an instance of AutoMlClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. See the subsequent parameters for more details.

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

Members

(static) apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

(static) port

The port for this API service.

(static) scopes

The scopes needed to make gRPC calls for every method defined in this service.

(static) servicePath

The DNS address for this API service.

Methods

annotationSpecPath(project, location, dataset, annotation_spec) → {string}

Return a fully-qualified annotationSpec resource name string.

Parameters:
Name Type Description
project string
location string
dataset string
annotation_spec string

close()

Terminate the GRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

createDataset(request, optionsopt) → {Promise}

Creates a dataset.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The resource name of the project to create the dataset for.

dataset google.cloud.automl.v1.Dataset

Required. The dataset to create.

options object <optional>

Call options. See CallOptions for more details.

createModel(request, optionsopt) → {Promise}

Creates a model. Returns a Model in the response field when it completes. When you create a model, several model evaluations are created for it: a global evaluation, and one evaluation for each annotation spec.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the parent project where the model is being created.

model google.cloud.automl.v1.Model

Required. The model to create.

options object <optional>

Call options. See CallOptions for more details.

datasetPath(project, location, dataset) → {string}

Return a fully-qualified dataset resource name string.

Parameters:
Name Type Description
project string
location string
dataset string

deleteDataset(request, optionsopt) → {Promise}

Deletes a dataset and all of its contents. Returns empty response in the response field when it completes, and delete_details in the metadata field.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the dataset to delete.

options object <optional>

Call options. See CallOptions for more details.

deleteModel(request, optionsopt) → {Promise}

Deletes a model. Returns google.protobuf.Empty in the response field when it completes, and delete_details in the metadata field.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Resource name of the model being deleted.

options object <optional>

Call options. See CallOptions for more details.

deployModel(request, optionsopt) → {Promise}

Deploys a model. If a model is already deployed, deploying it with the same parameters has no effect. Deploying with different parametrs (as e.g. changing

node_number) will reset the deployment state without pausing the model's availability.

Only applicable for Text Classification, Image Object Detection , Tables, and Image Segmentation; all other domains manage deployment automatically.

Returns an empty response in the response field when it completes.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
imageObjectDetectionModelDeploymentMetadata google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata

Model deployment metadata specific to Image Object Detection.

imageClassificationModelDeploymentMetadata google.cloud.automl.v1.ImageClassificationModelDeploymentMetadata

Model deployment metadata specific to Image Classification.

name string

Required. Resource name of the model to deploy.

options object <optional>

Call options. See CallOptions for more details.

exportData(request, optionsopt) → {Promise}

Exports dataset's data to the provided output location. Returns an empty response in the response field when it completes.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the dataset.

outputConfig google.cloud.automl.v1.OutputConfig

Required. The desired output location.

options object <optional>

Call options. See CallOptions for more details.

exportModel(request, optionsopt) → {Promise}

Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A model is considered export-able if and only if it has an export format defined for it in ModelExportOutputConfig.

Returns an empty response in the response field when it completes.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the model to export.

outputConfig google.cloud.automl.v1.ModelExportOutputConfig

Required. The desired output location and configuration.

options object <optional>

Call options. See CallOptions for more details.

getAnnotationSpec(request, optionsopt) → {Promise}

Gets an annotation spec.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the annotation spec to retrieve.

options object <optional>

Call options. See CallOptions for more details.

getDataset(request, optionsopt) → {Promise}

Gets a dataset.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the dataset to retrieve.

options object <optional>

Call options. See CallOptions for more details.

getModel(request, optionsopt) → {Promise}

Gets a model.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Resource name of the model.

options object <optional>

Call options. See CallOptions for more details.

getModelEvaluation(request, optionsopt) → {Promise}

Gets a model evaluation.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Resource name for the model evaluation.

options object <optional>

Call options. See CallOptions for more details.

getProjectId(callback)

Return the project ID used by this class.

Parameters:
Name Type Description
callback function

the callback to be called with the current project Id.

importData(request, optionsopt) → {Promise}

Imports data into a dataset. For Tables this method can only be called on an empty Dataset.

For Tables:

  • A schema_inference_version parameter must be explicitly set. Returns an empty response in the response field when it completes.
Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Dataset name. Dataset must already exist. All imported annotations and examples will be added.

inputConfig google.cloud.automl.v1.InputConfig

Required. The desired input location and its domain specific semantics, if any.

options object <optional>

Call options. See CallOptions for more details.

initialize() → {Promise}

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

listDatasets(request, optionsopt) → {Promise}

Lists datasets in a project.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The resource name of the project from which to list datasets.

filter string

An expression for filtering the results of the request.

* `dataset_metadata` - for existence of the case (e.g.
          image_classification_dataset_metadata:*). Some examples of using the filter are:

* `translation_dataset_metadata:*` --> The dataset has
                                       translation_dataset_metadata.
pageSize number

Requested page size. Server may return fewer results than requested. If unspecified, server will pick a default size.

pageToken string

A token identifying a page of results for the server to return Typically obtained via ListDatasetsResponse.next_page_token of the previous AutoMl.ListDatasets call.

options object <optional>

Call options. See CallOptions for more details.

listDatasetsAsync(request, optionsopt) → {Object}

Equivalent to listDatasets, but returns an iterable object.

for-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The resource name of the project from which to list datasets.

filter string

An expression for filtering the results of the request.

* `dataset_metadata` - for existence of the case (e.g.
          image_classification_dataset_metadata:*). Some examples of using the filter are:

* `translation_dataset_metadata:*` --> The dataset has
                                       translation_dataset_metadata.
pageSize number

Requested page size. Server may return fewer results than requested. If unspecified, server will pick a default size.

pageToken string

A token identifying a page of results for the server to return Typically obtained via ListDatasetsResponse.next_page_token of the previous AutoMl.ListDatasets call.

options object <optional>

Call options. See CallOptions for more details.

listDatasetsStream(request, optionsopt) → {Stream}

Equivalent to listDatasets, but returns a NodeJS Stream object.

This fetches the paged responses for listDatasets continuously and invokes the callback registered for 'data' event for each element in the responses.

The returned object has 'end' method when no more elements are required.

autoPaginate option will be ignored.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The resource name of the project from which to list datasets.

filter string

An expression for filtering the results of the request.

* `dataset_metadata` - for existence of the case (e.g.
          image_classification_dataset_metadata:*). Some examples of using the filter are:

* `translation_dataset_metadata:*` --> The dataset has
                                       translation_dataset_metadata.
pageSize number

Requested page size. Server may return fewer results than requested. If unspecified, server will pick a default size.

pageToken string

A token identifying a page of results for the server to return Typically obtained via ListDatasetsResponse.next_page_token of the previous AutoMl.ListDatasets call.

options object <optional>

Call options. See CallOptions for more details.

See:

listModelEvaluations(request, optionsopt) → {Promise}

Lists model evaluations.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the model to list the model evaluations for. If modelId is set as "-", this will list model evaluations from across all models of the parent location.

filter string

Required. An expression for filtering the results of the request.

* `annotation_spec_id` - for =, !=  or existence. See example below for
                       the last.

Some examples of using the filter are:

* `annotation_spec_id!=4` --> The model evaluation was done for
                          annotation spec with ID different than 4.
* `NOT annotation_spec_id:*` --> The model evaluation was done for
                             aggregate of all annotation specs.
pageSize number

Requested page size.

pageToken string

A token identifying a page of results for the server to return. Typically obtained via ListModelEvaluationsResponse.next_page_token of the previous AutoMl.ListModelEvaluations call.

options object <optional>

Call options. See CallOptions for more details.

listModelEvaluationsAsync(request, optionsopt) → {Object}

Equivalent to listModelEvaluations, but returns an iterable object.

for-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the model to list the model evaluations for. If modelId is set as "-", this will list model evaluations from across all models of the parent location.

filter string

Required. An expression for filtering the results of the request.

* `annotation_spec_id` - for =, !=  or existence. See example below for
                       the last.

Some examples of using the filter are:

* `annotation_spec_id!=4` --> The model evaluation was done for
                          annotation spec with ID different than 4.
* `NOT annotation_spec_id:*` --> The model evaluation was done for
                             aggregate of all annotation specs.
pageSize number

Requested page size.

pageToken string

A token identifying a page of results for the server to return. Typically obtained via ListModelEvaluationsResponse.next_page_token of the previous AutoMl.ListModelEvaluations call.

options object <optional>

Call options. See CallOptions for more details.

listModelEvaluationsStream(request, optionsopt) → {Stream}

Equivalent to listModelEvaluations, but returns a NodeJS Stream object.

This fetches the paged responses for listModelEvaluations continuously and invokes the callback registered for 'data' event for each element in the responses.

The returned object has 'end' method when no more elements are required.

autoPaginate option will be ignored.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the model to list the model evaluations for. If modelId is set as "-", this will list model evaluations from across all models of the parent location.

filter string

Required. An expression for filtering the results of the request.

* `annotation_spec_id` - for =, !=  or existence. See example below for
                       the last.

Some examples of using the filter are:

* `annotation_spec_id!=4` --> The model evaluation was done for
                          annotation spec with ID different than 4.
* `NOT annotation_spec_id:*` --> The model evaluation was done for
                             aggregate of all annotation specs.
pageSize number

Requested page size.

pageToken string

A token identifying a page of results for the server to return. Typically obtained via ListModelEvaluationsResponse.next_page_token of the previous AutoMl.ListModelEvaluations call.

options object <optional>

Call options. See CallOptions for more details.

See:

listModels(request, optionsopt) → {Promise}

Lists models.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the project, from which to list the models.

filter string

An expression for filtering the results of the request.

* `model_metadata` - for existence of the case (e.g.
          video_classification_model_metadata:*).
* `dataset_id` - for = or !=. Some examples of using the filter are:

* `image_classification_model_metadata:*` --> The model has
                                     image_classification_model_metadata.
* `dataset_id=5` --> The model was created from a dataset with ID 5.
pageSize number

Requested page size.

pageToken string

A token identifying a page of results for the server to return Typically obtained via ListModelsResponse.next_page_token of the previous AutoMl.ListModels call.

options object <optional>

Call options. See CallOptions for more details.

listModelsAsync(request, optionsopt) → {Object}

Equivalent to listModels, but returns an iterable object.

for-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the project, from which to list the models.

filter string

An expression for filtering the results of the request.

* `model_metadata` - for existence of the case (e.g.
          video_classification_model_metadata:*).
* `dataset_id` - for = or !=. Some examples of using the filter are:

* `image_classification_model_metadata:*` --> The model has
                                     image_classification_model_metadata.
* `dataset_id=5` --> The model was created from a dataset with ID 5.
pageSize number

Requested page size.

pageToken string

A token identifying a page of results for the server to return Typically obtained via ListModelsResponse.next_page_token of the previous AutoMl.ListModels call.

options object <optional>

Call options. See CallOptions for more details.

listModelsStream(request, optionsopt) → {Stream}

Equivalent to listModels, but returns a NodeJS Stream object.

This fetches the paged responses for listModels continuously and invokes the callback registered for 'data' event for each element in the responses.

The returned object has 'end' method when no more elements are required.

autoPaginate option will be ignored.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. Resource name of the project, from which to list the models.

filter string

An expression for filtering the results of the request.

* `model_metadata` - for existence of the case (e.g.
          video_classification_model_metadata:*).
* `dataset_id` - for = or !=. Some examples of using the filter are:

* `image_classification_model_metadata:*` --> The model has
                                     image_classification_model_metadata.
* `dataset_id=5` --> The model was created from a dataset with ID 5.
pageSize number

Requested page size.

pageToken string

A token identifying a page of results for the server to return Typically obtained via ListModelsResponse.next_page_token of the previous AutoMl.ListModels call.

options object <optional>

Call options. See CallOptions for more details.

See:

locationPath(project, location) → {string}

Return a fully-qualified location resource name string.

Parameters:
Name Type Description
project string
location string

matchAnnotationSpecFromAnnotationSpecName(annotationSpecName) → {string}

Parse the annotation_spec from AnnotationSpec resource.

Parameters:
Name Type Description
annotationSpecName string

A fully-qualified path representing AnnotationSpec resource.

matchDatasetFromAnnotationSpecName(annotationSpecName) → {string}

Parse the dataset from AnnotationSpec resource.

Parameters:
Name Type Description
annotationSpecName string

A fully-qualified path representing AnnotationSpec resource.

matchDatasetFromDatasetName(datasetName) → {string}

Parse the dataset from Dataset resource.

Parameters:
Name Type Description
datasetName string

A fully-qualified path representing Dataset resource.

matchLocationFromAnnotationSpecName(annotationSpecName) → {string}

Parse the location from AnnotationSpec resource.

Parameters:
Name Type Description
annotationSpecName string

A fully-qualified path representing AnnotationSpec resource.

matchLocationFromDatasetName(datasetName) → {string}

Parse the location from Dataset resource.

Parameters:
Name Type Description
datasetName string

A fully-qualified path representing Dataset resource.

matchLocationFromLocationName(locationName) → {string}

Parse the location from Location resource.

Parameters:
Name Type Description
locationName string

A fully-qualified path representing Location resource.

matchLocationFromModelEvaluationName(modelEvaluationName) → {string}

Parse the location from ModelEvaluation resource.

Parameters:
Name Type Description
modelEvaluationName string

A fully-qualified path representing ModelEvaluation resource.

matchLocationFromModelName(modelName) → {string}

Parse the location from Model resource.

Parameters:
Name Type Description
modelName string

A fully-qualified path representing Model resource.

matchModelEvaluationFromModelEvaluationName(modelEvaluationName) → {string}

Parse the model_evaluation from ModelEvaluation resource.

Parameters:
Name Type Description
modelEvaluationName string

A fully-qualified path representing ModelEvaluation resource.

matchModelFromModelEvaluationName(modelEvaluationName) → {string}

Parse the model from ModelEvaluation resource.

Parameters:
Name Type Description
modelEvaluationName string

A fully-qualified path representing ModelEvaluation resource.

matchModelFromModelName(modelName) → {string}

Parse the model from Model resource.

Parameters:
Name Type Description
modelName string

A fully-qualified path representing Model resource.

matchProjectFromAnnotationSpecName(annotationSpecName) → {string}

Parse the project from AnnotationSpec resource.

Parameters:
Name Type Description
annotationSpecName string

A fully-qualified path representing AnnotationSpec resource.

matchProjectFromDatasetName(datasetName) → {string}

Parse the project from Dataset resource.

Parameters:
Name Type Description
datasetName string

A fully-qualified path representing Dataset resource.

matchProjectFromLocationName(locationName) → {string}

Parse the project from Location resource.

Parameters:
Name Type Description
locationName string

A fully-qualified path representing Location resource.

matchProjectFromModelEvaluationName(modelEvaluationName) → {string}

Parse the project from ModelEvaluation resource.

Parameters:
Name Type Description
modelEvaluationName string

A fully-qualified path representing ModelEvaluation resource.

matchProjectFromModelName(modelName) → {string}

Parse the project from Model resource.

Parameters:
Name Type Description
modelName string

A fully-qualified path representing Model resource.

modelEvaluationPath(project, location, model, model_evaluation) → {string}

Return a fully-qualified modelEvaluation resource name string.

Parameters:
Name Type Description
project string
location string
model string
model_evaluation string

modelPath(project, location, model) → {string}

Return a fully-qualified model resource name string.

Parameters:
Name Type Description
project string
location string
model string

undeployModel(request, optionsopt) → {Promise}

Undeploys a model. If the model is not deployed this method has no effect.

Only applicable for Text Classification, Image Object Detection and Tables; all other domains manage deployment automatically.

Returns an empty response in the response field when it completes.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Resource name of the model to undeploy.

options object <optional>

Call options. See CallOptions for more details.

updateDataset(request, optionsopt) → {Promise}

Updates a dataset.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
dataset google.cloud.automl.v1.Dataset

Required. The dataset which replaces the resource on the server.

updateMask google.protobuf.FieldMask

Required. The update mask applies to the resource.

options object <optional>

Call options. See CallOptions for more details.

updateModel(request, optionsopt) → {Promise}

Updates a model.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
model google.cloud.automl.v1.Model

Required. The model which replaces the resource on the server.

updateMask google.protobuf.FieldMask

Required. The update mask applies to the resource.

options object <optional>

Call options. See CallOptions for more details.