Class AutoMlClient (0.6.0)

  AutoMlClient 
 ( 
 transport 
 = 
 None 
 , 
 channel 
 = 
 None 
 , 
 credentials 
 = 
 None 
 , 
 client_config 
 = 
 None 
 , 
 client_info 
 = 
 None 
 , 
 client_options 
 = 
 None 
 , 
 ) 
 

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.

Methods

AutoMlClient

  AutoMlClient 
 ( 
 transport 
 = 
 None 
 , 
 channel 
 = 
 None 
 , 
 credentials 
 = 
 None 
 , 
 client_config 
 = 
 None 
 , 
 client_info 
 = 
 None 
 , 
 client_options 
 = 
 None 
 , 
 ) 
 

Constructor.

Parameters
Name Description
channel grpc.Channel

DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials ; providing both will raise an exception.

credentials google.auth.credentials.Credentials

The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport ; doing so will raise an exception.

client_config dict

DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

client_info google.api_core.gapic_v1.client_info.ClientInfo

The client info used to send a user-agent string along with API requests. If None , then default info will be used. Generally, you only need to set this if you're developing your own client library.

client_options Union[dict, google.api_core.client_options.ClientOptions]

Client options used to set user options on the client. API Endpoint should be set through client_options.

annotation_spec_path

  annotation_spec_path 
 ( 
 project 
 , 
 location 
 , 
 dataset 
 , 
 annotation_spec 
 ) 
 

Return a fully-qualified annotation_spec string.

column_spec_path

  column_spec_path 
 ( 
 project 
 , 
 location 
 , 
 dataset 
 , 
 table_spec 
 , 
 column_spec 
 ) 
 

Return a fully-qualified column_spec string.

create_dataset

  create_dataset 
 ( 
 parent 
 , 
 dataset 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Creates a dataset.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.location_path('[PROJECT]', '[LOCATION]')

TODO: Initialize dataset :

dataset = {}

response = client.create_dataset(parent, dataset)

Parameters
Name Description
parent str

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

dataset Union[dict, Dataset ]

The dataset to create. If a dict is provided, it must be of the same form as the protobuf message Dataset

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

create_model

  create_model 
 ( 
 parent 
 , 
 model 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.location_path('[PROJECT]', '[LOCATION]')

TODO: Initialize model :

model = {}

response = client.create_model(parent, model)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
parent str

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

model Union[dict, Model ]

The model to create. If a dict is provided, it must be of the same form as the protobuf message Model

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

dataset_path

  dataset_path 
 ( 
 project 
 , 
 location 
 , 
 dataset 
 ) 
 

Return a fully-qualified dataset string.

delete_dataset

  delete_dataset 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]')

response = client.delete_dataset(name)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

The resource name of the dataset to delete.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

delete_model

  delete_model 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

response = client.delete_model(name)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

Resource name of the model being deleted.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

deploy_model

  deploy_model 
 ( 
 name 
 , 
 image_object_detection_model_deployment_metadata 
 = 
 None 
 , 
 image_classification_model_deployment_metadata 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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 and Tables; all other domains manage deployment automatically.

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

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

response = client.deploy_model(name)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

Resource name of the model to deploy.

image_object_detection_model_deployment_metadata Union[dict, ImageObjectDetectionModelDeploymentMetadata ]

Model deployment metadata specific to Image Object Detection. If a dict is provided, it must be of the same form as the protobuf message ImageObjectDetectionModelDeploymentMetadata

image_classification_model_deployment_metadata Union[dict, ImageClassificationModelDeploymentMetadata ]

Model deployment metadata specific to Image Classification. If a dict is provided, it must be of the same form as the protobuf message ImageClassificationModelDeploymentMetadata

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

export_data

  export_data 
 ( 
 name 
 , 
 output_config 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]')

TODO: Initialize output_config :

output_config = {}

response = client.export_data(name, output_config)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

Required. The resource name of the dataset.

output_config Union[dict, OutputConfig ]

Required. The desired output location. If a dict is provided, it must be of the same form as the protobuf message OutputConfig

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

export_evaluated_examples

  export_evaluated_examples 
 ( 
 name 
 , 
 output_config 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Exports examples on which the model was evaluated (i.e. which were in the TEST set of the dataset the model was created from), together with their ground truth annotations and the annotations created (predicted) by the model. The examples, ground truth and predictions are exported in the state they were at the moment the model was evaluated.

This export is available only for 30 days since the model evaluation is created.

Currently only available for Tables.

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

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

TODO: Initialize output_config :

output_config = {}

response = client.export_evaluated_examples(name, output_config)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

Required. The resource name of the model whose evaluated examples are to be exported.

output_config Union[dict, ExportEvaluatedExamplesOutputConfig ]

Required. The desired output location and configuration. If a dict is provided, it must be of the same form as the protobuf message ExportEvaluatedExamplesOutputConfig

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

export_model

  export_model 
 ( 
 name 
 , 
 output_config 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

TODO: Initialize output_config :

output_config = {}

response = client.export_model(name, output_config)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

Required. The resource name of the model to export.

output_config Union[dict, ModelExportOutputConfig ]

Required. The desired output location and configuration. If a dict is provided, it must be of the same form as the protobuf message ModelExportOutputConfig

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.
  from_service_account_file 
 ( 
 filename 
 , 
 * 
 args 
 , 
 ** 
 kwargs 
 ) 
 

Creates an instance of this client using the provided credentials file.

Parameter
Name Description
filename str

The path to the service account private key json file.

Returns
Type Description
AutoMlClient The constructed client.
  from_service_account_json 
 ( 
 filename 
 , 
 * 
 args 
 , 
 ** 
 kwargs 
 ) 
 

Creates an instance of this client using the provided credentials file.

Parameter
Name Description
filename str

The path to the service account private key json file.

Returns
Type Description
AutoMlClient The constructed client.

get_annotation_spec

  get_annotation_spec 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Gets an annotation spec.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.annotation_spec_path('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]')

response = client.get_annotation_spec(name)

Parameters
Name Description
name str

The resource name of the annotation spec to retrieve.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

get_column_spec

  get_column_spec 
 ( 
 name 
 , 
 field_mask 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Gets a column spec.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.column_spec_path('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]', '[COLUMN_SPEC]')

response = client.get_column_spec(name)

Parameters
Name Description
name str

The resource name of the column spec to retrieve.

field_mask Union[dict, FieldMask ]

Mask specifying which fields to read. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

get_dataset

  get_dataset 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Gets a dataset.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]')

response = client.get_dataset(name)

Parameters
Name Description
name str

The resource name of the dataset to retrieve.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

get_model

  get_model 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Gets a model.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

response = client.get_model(name)

Parameters
Name Description
name str

Resource name of the model.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

get_model_evaluation

  get_model_evaluation 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Gets a model evaluation.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_evaluation_path('[PROJECT]', '[LOCATION]', '[MODEL]', '[MODEL_EVALUATION]')

response = client.get_model_evaluation(name)

Parameters
Name Description
name str

Resource name for the model evaluation.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

get_table_spec

  get_table_spec 
 ( 
 name 
 , 
 field_mask 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Gets a table spec.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.table_spec_path('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]')

response = client.get_table_spec(name)

Parameters
Name Description
name str

The resource name of the table spec to retrieve.

field_mask Union[dict, FieldMask ]

Mask specifying which fields to read. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

import_data

  import_data 
 ( 
 name 
 , 
 input_config 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]')

TODO: Initialize input_config :

input_config = {}

response = client.import_data(name, input_config)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

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

input_config Union[dict, InputConfig ]

Required. The desired input location and its domain specific semantics, if any. If a dict is provided, it must be of the same form as the protobuf message InputConfig

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

list_column_specs

  list_column_specs 
 ( 
 parent 
 , 
 field_mask 
 = 
 None 
 , 
 filter_ 
 = 
 None 
 , 
 page_size 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Lists column specs in a table spec.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.table_spec_path('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]')

Iterate over all results

for element in client.list_column_specs(parent): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_column_specs(parent).pages: ... for element in page: ... # process element ... pass

Parameters
Name Description
parent str

The resource name of the table spec to list column specs from.

field_mask Union[dict, FieldMask ]

Mask specifying which fields to read. If a dict is provided, it must be of the same form as the protobuf message FieldMask

filter_ str

Filter expression, see go/filtering.

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

list_datasets

  list_datasets 
 ( 
 parent 
 , 
 filter_ 
 = 
 None 
 , 
 page_size 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Lists datasets in a project.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.location_path('[PROJECT]', '[LOCATION]')

Iterate over all results

for element in client.list_datasets(parent): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_datasets(parent).pages: ... for element in page: ... # process element ... pass

Parameters
Name Description
parent str

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

filter_ str

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.

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

list_model_evaluations

  list_model_evaluations 
 ( 
 parent 
 , 
 filter_ 
 = 
 None 
 , 
 page_size 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Lists model evaluations.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

Iterate over all results

for element in client.list_model_evaluations(parent): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_model_evaluations(parent).pages: ... for element in page: ... # process element ... pass

Parameters
Name Description
parent str

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_ str

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.

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

list_models

  list_models 
 ( 
 parent 
 , 
 filter_ 
 = 
 None 
 , 
 page_size 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Lists models.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.location_path('[PROJECT]', '[LOCATION]')

Iterate over all results

for element in client.list_models(parent): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_models(parent).pages: ... for element in page: ... # process element ... pass

Parameters
Name Description
parent str

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

filter_ str

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.

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

list_table_specs

  list_table_specs 
 ( 
 parent 
 , 
 field_mask 
 = 
 None 
 , 
 filter_ 
 = 
 None 
 , 
 page_size 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Lists table specs in a dataset.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

parent = client.dataset_path('[PROJECT]', '[LOCATION]', '[DATASET]')

Iterate over all results

for element in client.list_table_specs(parent): ... # process element ... pass

Alternatively:

Iterate over results one page at a time

for page in client.list_table_specs(parent).pages: ... for element in page: ... # process element ... pass

Parameters
Name Description
parent str

The resource name of the dataset to list table specs from.

field_mask Union[dict, FieldMask ]

Mask specifying which fields to read. If a dict is provided, it must be of the same form as the protobuf message FieldMask

filter_ str

Filter expression, see go/filtering.

page_size int

The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

location_path

  location_path 
 ( 
 project 
 , 
 location 
 ) 
 

Return a fully-qualified location string.

model_evaluation_path

  model_evaluation_path 
 ( 
 project 
 , 
 location 
 , 
 model 
 , 
 model_evaluation 
 ) 
 

Return a fully-qualified model_evaluation string.

model_path

  model_path 
 ( 
 project 
 , 
 location 
 , 
 model 
 ) 
 

Return a fully-qualified model string.

table_spec_path

  table_spec_path 
 ( 
 project 
 , 
 location 
 , 
 dataset 
 , 
 table_spec 
 ) 
 

Return a fully-qualified table_spec string.

undeploy_model

  undeploy_model 
 ( 
 name 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

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.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

name = client.model_path('[PROJECT]', '[LOCATION]', '[MODEL]')

response = client.undeploy_model(name)

def callback(operation_future): ... # Handle result. ... result = operation_future.result()

response.add_done_callback(callback)

Handle metadata.

metadata = response.metadata()

Parameters
Name Description
name str

Resource name of the model to undeploy.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

update_column_spec

  update_column_spec 
 ( 
 column_spec 
 , 
 update_mask 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Updates a column spec.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

TODO: Initialize column_spec :

column_spec = {}

response = client.update_column_spec(column_spec)

Parameters
Name Description
column_spec Union[dict, ColumnSpec ]

The column spec which replaces the resource on the server. If a dict is provided, it must be of the same form as the protobuf message ColumnSpec

update_mask Union[dict, FieldMask ]

The update mask applies to the resource. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

update_dataset

  update_dataset 
 ( 
 dataset 
 , 
 update_mask 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Updates a dataset.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

TODO: Initialize dataset :

dataset = {}

response = client.update_dataset(dataset)

Parameters
Name Description
dataset Union[dict, Dataset ]

The dataset which replaces the resource on the server. If a dict is provided, it must be of the same form as the protobuf message Dataset

update_mask Union[dict, FieldMask ]

The update mask applies to the resource. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.

update_table_spec

  update_table_spec 
 ( 
 table_spec 
 , 
 update_mask 
 = 
 None 
 , 
 retry 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 timeout 
 = 
< _MethodDefault 
 . 
 _DEFAULT_VALUE 
 : 
< object 
 object 
>> , 
 metadata 
 = 
 None 
 ) 
 

Updates a table spec.

.. rubric:: Example

from google.cloud import automl_v1beta1

client = automl_v1beta1.AutoMlClient()

TODO: Initialize table_spec :

table_spec = {}

response = client.update_table_spec(table_spec)

Parameters
Name Description
table_spec Union[dict, TableSpec ]

The table spec which replaces the resource on the server. If a dict is provided, it must be of the same form as the protobuf message TableSpec

update_mask Union[dict, FieldMask ]

The update mask applies to the resource. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
Type Description
google.api_core.exceptions.GoogleAPICallError If the request failed for any reason.
google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed.
ValueError If the parameters are invalid.
Create a Mobile Website
View Site in Mobile | Classic
Share by: