v1beta1. AutoMlClient
Source: v1beta1/
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.
Properties
Methods
- annotationSpecPath(project, location, dataset, annotationSpec)
- columnSpecPath(project, location, dataset, tableSpec, columnSpec)
- createDataset(request[, options][, callback])
- createModel(request[, options][, callback])
- datasetPath(project, location, dataset)
- deleteDataset(request[, options][, callback])
- deleteModel(request[, options][, callback])
- deployModel(request[, options][, callback])
- exportData(request[, options][, callback])
- exportEvaluatedExamples(request[, options][, callback])
- exportModel(request[, options][, callback])
- getAnnotationSpec(request[, options][, callback])
- getColumnSpec(request[, options][, callback])
- getDataset(request[, options][, callback])
- getModel(request[, options][, callback])
- getModelEvaluation(request[, options][, callback])
- getProjectId(callback)
- getTableSpec(request[, options][, callback])
- importData(request[, options][, callback])
- listColumnSpecs(request[, options][, callback])
- listColumnSpecsStream(request[, options])
- listDatasets(request[, options][, callback])
- listDatasetsStream(request[, options])
- listModelEvaluations(request[, options][, callback])
- listModelEvaluationsStream(request[, options])
- listModels(request[, options][, callback])
- listModelsStream(request[, options])
- listTableSpecs(request[, options][, callback])
- listTableSpecsStream(request[, options])
- locationPath(project, location)
- matchAnnotationSpecFromAnnotationSpecName(annotationSpecName)
- matchColumnSpecFromColumnSpecName(columnSpecName)
- matchDatasetFromAnnotationSpecName(annotationSpecName)
- matchDatasetFromColumnSpecName(columnSpecName)
- matchDatasetFromDatasetName(datasetName)
- matchDatasetFromTableSpecName(tableSpecName)
- matchLocationFromAnnotationSpecName(annotationSpecName)
- matchLocationFromColumnSpecName(columnSpecName)
- matchLocationFromDatasetName(datasetName)
- matchLocationFromLocationName(locationName)
- matchLocationFromModelEvaluationName(modelEvaluationName)
- matchLocationFromModelName(modelName)
- matchLocationFromTableSpecName(tableSpecName)
- matchModelEvaluationFromModelEvaluationName(modelEvaluationName)
- matchModelFromModelEvaluationName(modelEvaluationName)
- matchModelFromModelName(modelName)
- matchProjectFromAnnotationSpecName(annotationSpecName)
- matchProjectFromColumnSpecName(columnSpecName)
- matchProjectFromDatasetName(datasetName)
- matchProjectFromLocationName(locationName)
- matchProjectFromModelEvaluationName(modelEvaluationName)
- matchProjectFromModelName(modelName)
- matchProjectFromTableSpecName(tableSpecName)
- matchTableSpecFromColumnSpecName(columnSpecName)
- matchTableSpecFromTableSpecName(tableSpecName)
- modelEvaluationPath(project, location, model, modelEvaluation)
- modelPath(project, location, model)
- tableSpecPath(project, location, dataset, tableSpec)
- undeployModel(request[, options][, callback])
- updateColumnSpec(request[, options][, callback])
- updateDataset(request[, options][, callback])
- updateTableSpec(request[, options][, callback])
new AutoMlClient([options])
Construct an instance of AutoMlClient.
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
options |
|
Yes |
The configuration object. See the subsequent parameters for more details. Values in
|
Properties
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
annotationSpecPath(project, location, dataset, annotationSpec) → String
Return a fully-qualified annotation_spec resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
|
|
dataset |
String |
|
|
|
annotationSpec |
String |
|
- Returns
String
columnSpecPath(project, location, dataset, tableSpec, columnSpec) → String
Return a fully-qualified column_spec resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
|
|
dataset |
String |
|
|
|
tableSpec |
String |
|
|
|
columnSpec |
String |
|
- Returns
String
createDataset(request[, options][, callback]) → Promise
Creates a dataset.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
const dataset = {};
const request = {
parent: formattedParent,
dataset: dataset,
};
client.createDataset(request)
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing Dataset. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing Dataset. The promise has a method named "cancel" which cancels the ongoing API call.
createModel(request[, options][, callback]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
const model = {};
const request = {
parent: formattedParent,
model: model,
};
// Handle the operation using the promise pattern.
client.createModel(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
const model = {};
const request = {
parent: formattedParent,
model: model,
};
// Handle the operation using the event emitter pattern.
client.createModel(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
const model = {};
const request = {
parent: formattedParent,
model: model,
};
// Handle the operation using the await pattern.
const [operation] = await client.createModel(request);
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
datasetPath(project, location, dataset) → String
Return a fully-qualified dataset resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
|
|
dataset |
String |
|
- Returns
String
deleteDataset(request[, options][, callback]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
// Handle the operation using the promise pattern.
client.deleteDataset({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
// Handle the operation using the event emitter pattern.
client.deleteDataset({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
// Handle the operation using the await pattern.
const [operation] = await client.deleteDataset({name: formattedName});
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
deleteModel(request[, options][, callback]) → Promise
Deletes a model.
Returns google.protobuf.Empty in the
response field when it completes,
and delete_details in the
metadata field.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the promise pattern.
client.deleteModel({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the event emitter pattern.
client.deleteModel({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the await pattern.
const [operation] = await client.deleteModel({name: formattedName});
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
deployModel(request[, options][, callback]) → 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 and Tables; all other domains manage deployment automatically.
Returns an empty response in the response field when it completes.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the promise pattern.
client.deployModel({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the event emitter pattern.
client.deployModel({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the await pattern.
const [operation] = await client.deployModel({name: formattedName});
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
exportData(request[, options][, callback]) → Promise
Exports dataset's data to the provided output location. Returns an empty response in the response field when it completes.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the promise pattern.
client.exportData(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the event emitter pattern.
client.exportData(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the await pattern.
const [operation] = await client.exportData(request);
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
exportEvaluatedExamples(request[, options][, callback]) → Promise
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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the promise pattern.
client.exportEvaluatedExamples(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the event emitter pattern.
client.exportEvaluatedExamples(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the await pattern.
const [operation] = await client.exportEvaluatedExamples(request);
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
exportModel(request[, options][, callback]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the promise pattern.
client.exportModel(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the event emitter pattern.
client.exportModel(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const outputConfig = {};
const request = {
name: formattedName,
outputConfig: outputConfig,
};
// Handle the operation using the await pattern.
const [operation] = await client.exportModel(request);
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
getAnnotationSpec(request[, options][, callback]) → Promise
Gets an annotation spec.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.annotationSpecPath('[PROJECT]', '[LOCATION]', '[DATASET]', '[ANNOTATION_SPEC]');
client.getAnnotationSpec({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing AnnotationSpec. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing AnnotationSpec. The promise has a method named "cancel" which cancels the ongoing API call.
getColumnSpec(request[, options][, callback]) → Promise
Gets a column spec.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.columnSpecPath('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]', '[COLUMN_SPEC]');
client.getColumnSpec({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing ColumnSpec. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing ColumnSpec. The promise has a method named "cancel" which cancels the ongoing API call.
getDataset(request[, options][, callback]) → Promise
Gets a dataset.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
client.getDataset({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing Dataset. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing Dataset. The promise has a method named "cancel" which cancels the ongoing API call.
getModel(request[, options][, callback]) → Promise
Gets a model.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
client.getModel({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing Model. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing Model. The promise has a method named "cancel" which cancels the ongoing API call.
getModelEvaluation(request[, options][, callback]) → Promise
Gets a model evaluation.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelEvaluationPath('[PROJECT]', '[LOCATION]', '[MODEL]', '[MODEL_EVALUATION]');
client.getModelEvaluation({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing ModelEvaluation. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing ModelEvaluation. The promise has a method named "cancel" which cancels the ongoing API call.
getProjectId(callback)
Return the project ID used by this class.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
callback |
function(Error, string) |
|
the callback to be called with the current project Id. |
getTableSpec(request[, options][, callback]) → Promise
Gets a table spec.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.tableSpecPath('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]');
client.getTableSpec({name: formattedName})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing TableSpec. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing TableSpec. The promise has a method named "cancel" which cancels the ongoing API call.
importData(request[, options][, callback]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const inputConfig = {};
const request = {
name: formattedName,
inputConfig: inputConfig,
};
// Handle the operation using the promise pattern.
client.importData(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const inputConfig = {};
const request = {
name: formattedName,
inputConfig: inputConfig,
};
// Handle the operation using the event emitter pattern.
client.importData(request)
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const inputConfig = {};
const request = {
name: formattedName,
inputConfig: inputConfig,
};
// Handle the operation using the await pattern.
const [operation] = await client.importData(request);
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
listColumnSpecs(request[, options][, callback]) → Promise
Lists column specs in a table spec.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.tableSpecPath('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]');
client.listColumnSpecs({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.tableSpecPath('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listColumnSpecs(nextRequest, options).then(callback);
}
}
client.listColumnSpecs({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of ColumnSpec. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListColumnSpecsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of ColumnSpec.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of ColumnSpec in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListColumnSpecsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listColumnSpecsStream(request[, options]) → Stream
Equivalent to listColumnSpecs, but returns a NodeJS Stream object.
This fetches the paged responses for listColumnSpecs 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.tableSpecPath('[PROJECT]', '[LOCATION]', '[DATASET]', '[TABLE_SPEC]');
client.listColumnSpecsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing ColumnSpec on 'data' event.
listDatasets(request[, options][, callback]) → Promise
Lists datasets in a project.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
client.listDatasets({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listDatasets(nextRequest, options).then(callback);
}
}
client.listDatasets({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of Dataset. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListDatasetsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of Dataset.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of Dataset in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListDatasetsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listDatasetsStream(request[, options]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
client.listDatasetsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing Dataset on 'data' event.
listModelEvaluations(request[, options][, callback]) → Promise
Lists model evaluations.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
client.listModelEvaluations({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listModelEvaluations(nextRequest, options).then(callback);
}
}
client.listModelEvaluations({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of ModelEvaluation. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListModelEvaluationsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of ModelEvaluation.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of ModelEvaluation in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListModelEvaluationsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listModelEvaluationsStream(request[, options]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
client.listModelEvaluationsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing ModelEvaluation on 'data' event.
listModels(request[, options][, callback]) → Promise
Lists models.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
client.listModels({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listModels(nextRequest, options).then(callback);
}
}
client.listModels({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of Model. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListModelsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of Model.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of Model in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListModelsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listModelsStream(request[, options]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]');
client.listModelsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing Model on 'data' event.
listTableSpecs(request[, options][, callback]) → Promise
Lists table specs in a dataset.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
// Iterate over all elements.
const formattedParent = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
client.listTableSpecs({parent: formattedParent})
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
// doThingsWith(resource)
}
})
.catch(err => {
console.error(err);
});
// Or obtain the paged response.
const formattedParent = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
const options = {autoPaginate: false};
const callback = responses => {
// The actual resources in a response.
const resources = responses[0];
// The next request if the response shows that there are more responses.
const nextRequest = responses[1];
// The actual response object, if necessary.
// const rawResponse = responses[2];
for (const resource of resources) {
// doThingsWith(resource);
}
if (nextRequest) {
// Fetch the next page.
return client.listTableSpecs(nextRequest, options).then(callback);
}
}
client.listTableSpecs({parent: formattedParent}, options)
.then(callback)
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||||||||||
|
callback |
function(nullable Error, nullable Array, nullable Object, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is Array of TableSpec. When autoPaginate: false is specified through options, it contains the result in a single response. If the response indicates the next page exists, the third parameter is set to be used for the next request object. The fourth parameter keeps the raw response object of an object representing ListTableSpecsResponse. |
- Returns
Promise-
The promise which resolves to an array. The first element of the array is Array of TableSpec.
When autoPaginate: false is specified through options, the array has three elements. The first element is Array of TableSpec in a single response. The second element is the next request object if the response indicates the next page exists, or null. The third element is an object representing ListTableSpecsResponse.
The promise has a method named "cancel" which cancels the ongoing API call.
-
listTableSpecsStream(request[, options]) → Stream
Equivalent to listTableSpecs, but returns a NodeJS Stream object.
This fetches the paged responses for listTableSpecs 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedParent = client.datasetPath('[PROJECT]', '[LOCATION]', '[DATASET]');
client.listTableSpecsStream({parent: formattedParent})
.on('data', element => {
// doThingsWith(element)
}).on('error', err => {
console.log(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
- See also
- https://nodejs.org/api/stream.html
- Returns
StreamAn object stream which emits an object representing TableSpec on 'data' event.
locationPath(project, location) → String
Return a fully-qualified location resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
- Returns
String
matchAnnotationSpecFromAnnotationSpecName(annotationSpecName) → String
Parse the annotationSpecName from a annotation_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
annotationSpecName |
String |
|
A fully-qualified path representing a annotation_spec resources. |
- Returns
String- A string representing the annotation_spec.
matchColumnSpecFromColumnSpecName(columnSpecName) → String
Parse the columnSpecName from a column_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
columnSpecName |
String |
|
A fully-qualified path representing a column_spec resources. |
- Returns
String- A string representing the column_spec.
matchDatasetFromAnnotationSpecName(annotationSpecName) → String
Parse the annotationSpecName from a annotation_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
annotationSpecName |
String |
|
A fully-qualified path representing a annotation_spec resources. |
- Returns
String- A string representing the dataset.
matchDatasetFromColumnSpecName(columnSpecName) → String
Parse the columnSpecName from a column_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
columnSpecName |
String |
|
A fully-qualified path representing a column_spec resources. |
- Returns
String- A string representing the dataset.
matchDatasetFromDatasetName(datasetName) → String
Parse the datasetName from a dataset resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
datasetName |
String |
|
A fully-qualified path representing a dataset resources. |
- Returns
String- A string representing the dataset.
matchDatasetFromTableSpecName(tableSpecName) → String
Parse the tableSpecName from a table_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
tableSpecName |
String |
|
A fully-qualified path representing a table_spec resources. |
- Returns
String- A string representing the dataset.
matchLocationFromAnnotationSpecName(annotationSpecName) → String
Parse the annotationSpecName from a annotation_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
annotationSpecName |
String |
|
A fully-qualified path representing a annotation_spec resources. |
- Returns
String- A string representing the location.
matchLocationFromColumnSpecName(columnSpecName) → String
Parse the columnSpecName from a column_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
columnSpecName |
String |
|
A fully-qualified path representing a column_spec resources. |
- Returns
String- A string representing the location.
matchLocationFromDatasetName(datasetName) → String
Parse the datasetName from a dataset resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
datasetName |
String |
|
A fully-qualified path representing a dataset resources. |
- Returns
String- A string representing the location.
matchLocationFromLocationName(locationName) → String
Parse the locationName from a location resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
locationName |
String |
|
A fully-qualified path representing a location resources. |
- Returns
String- A string representing the location.
matchLocationFromModelEvaluationName(modelEvaluationName) → String
Parse the modelEvaluationName from a model_evaluation resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelEvaluationName |
String |
|
A fully-qualified path representing a model_evaluation resources. |
- Returns
String- A string representing the location.
matchLocationFromModelName(modelName) → String
Parse the modelName from a model resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelName |
String |
|
A fully-qualified path representing a model resources. |
- Returns
String- A string representing the location.
matchLocationFromTableSpecName(tableSpecName) → String
Parse the tableSpecName from a table_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
tableSpecName |
String |
|
A fully-qualified path representing a table_spec resources. |
- Returns
String- A string representing the location.
matchModelEvaluationFromModelEvaluationName(modelEvaluationName) → String
Parse the modelEvaluationName from a model_evaluation resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelEvaluationName |
String |
|
A fully-qualified path representing a model_evaluation resources. |
- Returns
String- A string representing the model_evaluation.
matchModelFromModelEvaluationName(modelEvaluationName) → String
Parse the modelEvaluationName from a model_evaluation resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelEvaluationName |
String |
|
A fully-qualified path representing a model_evaluation resources. |
- Returns
String- A string representing the model.
matchModelFromModelName(modelName) → String
Parse the modelName from a model resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelName |
String |
|
A fully-qualified path representing a model resources. |
- Returns
String- A string representing the model.
matchProjectFromAnnotationSpecName(annotationSpecName) → String
Parse the annotationSpecName from a annotation_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
annotationSpecName |
String |
|
A fully-qualified path representing a annotation_spec resources. |
- Returns
String- A string representing the project.
matchProjectFromColumnSpecName(columnSpecName) → String
Parse the columnSpecName from a column_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
columnSpecName |
String |
|
A fully-qualified path representing a column_spec resources. |
- Returns
String- A string representing the project.
matchProjectFromDatasetName(datasetName) → String
Parse the datasetName from a dataset resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
datasetName |
String |
|
A fully-qualified path representing a dataset resources. |
- Returns
String- A string representing the project.
matchProjectFromLocationName(locationName) → String
Parse the locationName from a location resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
locationName |
String |
|
A fully-qualified path representing a location resources. |
- Returns
String- A string representing the project.
matchProjectFromModelEvaluationName(modelEvaluationName) → String
Parse the modelEvaluationName from a model_evaluation resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelEvaluationName |
String |
|
A fully-qualified path representing a model_evaluation resources. |
- Returns
String- A string representing the project.
matchProjectFromModelName(modelName) → String
Parse the modelName from a model resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
modelName |
String |
|
A fully-qualified path representing a model resources. |
- Returns
String- A string representing the project.
matchProjectFromTableSpecName(tableSpecName) → String
Parse the tableSpecName from a table_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
tableSpecName |
String |
|
A fully-qualified path representing a table_spec resources. |
- Returns
String- A string representing the project.
matchTableSpecFromColumnSpecName(columnSpecName) → String
Parse the columnSpecName from a column_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
columnSpecName |
String |
|
A fully-qualified path representing a column_spec resources. |
- Returns
String- A string representing the table_spec.
matchTableSpecFromTableSpecName(tableSpecName) → String
Parse the tableSpecName from a table_spec resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
tableSpecName |
String |
|
A fully-qualified path representing a table_spec resources. |
- Returns
String- A string representing the table_spec.
modelEvaluationPath(project, location, model, modelEvaluation) → String
Return a fully-qualified model_evaluation resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
|
|
model |
String |
|
|
|
modelEvaluation |
String |
|
- Returns
String
modelPath(project, location, model) → String
Return a fully-qualified model resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
|
|
model |
String |
|
- Returns
String
tableSpecPath(project, location, dataset, tableSpec) → String
Return a fully-qualified table_spec resource name string.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
project |
String |
|
|
|
location |
String |
|
|
|
dataset |
String |
|
|
|
tableSpec |
String |
|
- Returns
String
undeployModel(request[, options][, callback]) → 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.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the promise pattern.
client.undeployModel({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Operation#promise starts polling for the completion of the LRO.
return operation.promise();
})
.then(responses => {
const result = responses[0];
const metadata = responses[1];
const finalApiResponse = responses[2];
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the event emitter pattern.
client.undeployModel({name: formattedName})
.then(responses => {
const [operation, initialApiResponse] = responses;
// Adding a listener for the "complete" event starts polling for the
// completion of the operation.
operation.on('complete', (result, metadata, finalApiResponse) => {
// doSomethingWith(result);
});
// Adding a listener for the "progress" event causes the callback to be
// called on any change in metadata when the operation is polled.
operation.on('progress', (metadata, apiResponse) => {
// doSomethingWith(metadata)
});
// Adding a listener for the "error" event handles any errors found during polling.
operation.on('error', err => {
// throw(err);
});
})
.catch(err => {
console.error(err);
});
const formattedName = client.modelPath('[PROJECT]', '[LOCATION]', '[MODEL]');
// Handle the operation using the await pattern.
const [operation] = await client.undeployModel({name: formattedName});
const [response] = await operation.promise();
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is a gax.Operation object. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is a gax.Operation object. The promise has a method named "cancel" which cancels the ongoing API call.
updateColumnSpec(request[, options][, callback]) → Promise
Updates a column spec.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const columnSpec = {};
client.updateColumnSpec({columnSpec: columnSpec})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing ColumnSpec. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing ColumnSpec. The promise has a method named "cancel" which cancels the ongoing API call.
updateDataset(request[, options][, callback]) → Promise
Updates a dataset.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const dataset = {};
client.updateDataset({dataset: dataset})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing Dataset. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing Dataset. The promise has a method named "cancel" which cancels the ongoing API call.
updateTableSpec(request[, options][, callback]) → Promise
Updates a table spec.
Example
const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient({
// optional auth parameters.
});
const tableSpec = {};
client.updateTableSpec({tableSpec: tableSpec})
.then(responses => {
const response = responses[0];
// doThingsWith(response)
})
.catch(err => {
console.error(err);
});
Parameters
| Name | Type | Optional | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
request |
Object |
|
The request object that will be sent. Values in
|
||||||||||||
|
options |
Object |
Yes |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||||||||
|
callback |
function(nullable Error, nullable Object) |
Yes |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing TableSpec. |
- Returns
Promise- The promise which resolves to an array. The first element of the array is an object representing TableSpec. The promise has a method named "cancel" which cancels the ongoing API call.