Documentation ¶
Overview ¶
Package automl is an auto-generated package for the Cloud AutoML API.
Train high-quality custom machine learning models with minimum effort and machine learning expertise.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
Use of Context ¶
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit pkg.go.dev/cloud.google.com/go.
Index ¶
- func DefaultAuthScopes() []string
- type BatchPredictOperation
- func (op *BatchPredictOperation) Done() bool
- func (op *BatchPredictOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *BatchPredictOperation) Name() string
- func (op *BatchPredictOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*automlpb.BatchPredictResult, error)
- func (op *BatchPredictOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*automlpb.BatchPredictResult, error)
- type CallOptions
- type Client
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConn
- func (c *Client) CreateDataset(ctx context.Context, req *automlpb.CreateDatasetRequest, ...) (*automlpb.Dataset, error)
- func (c *Client) CreateModel(ctx context.Context, req *automlpb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error)
- func (c *Client) CreateModelOperation(name string) *CreateModelOperation
- func (c *Client) DeleteDataset(ctx context.Context, req *automlpb.DeleteDatasetRequest, ...) (*DeleteDatasetOperation, error)
- func (c *Client) DeleteDatasetOperation(name string) *DeleteDatasetOperation
- func (c *Client) DeleteModel(ctx context.Context, req *automlpb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error)
- func (c *Client) DeleteModelOperation(name string) *DeleteModelOperation
- func (c *Client) DeployModel(ctx context.Context, req *automlpb.DeployModelRequest, opts ...gax.CallOption) (*DeployModelOperation, error)
- func (c *Client) DeployModelOperation(name string) *DeployModelOperation
- func (c *Client) ExportData(ctx context.Context, req *automlpb.ExportDataRequest, opts ...gax.CallOption) (*ExportDataOperation, error)
- func (c *Client) ExportDataOperation(name string) *ExportDataOperation
- func (c *Client) ExportEvaluatedExamples(ctx context.Context, req *automlpb.ExportEvaluatedExamplesRequest, ...) (*ExportEvaluatedExamplesOperation, error)
- func (c *Client) ExportEvaluatedExamplesOperation(name string) *ExportEvaluatedExamplesOperation
- func (c *Client) ExportModel(ctx context.Context, req *automlpb.ExportModelRequest, opts ...gax.CallOption) (*ExportModelOperation, error)
- func (c *Client) ExportModelOperation(name string) *ExportModelOperation
- func (c *Client) GetAnnotationSpec(ctx context.Context, req *automlpb.GetAnnotationSpecRequest, ...) (*automlpb.AnnotationSpec, error)
- func (c *Client) GetColumnSpec(ctx context.Context, req *automlpb.GetColumnSpecRequest, ...) (*automlpb.ColumnSpec, error)
- func (c *Client) GetDataset(ctx context.Context, req *automlpb.GetDatasetRequest, opts ...gax.CallOption) (*automlpb.Dataset, error)
- func (c *Client) GetModel(ctx context.Context, req *automlpb.GetModelRequest, opts ...gax.CallOption) (*automlpb.Model, error)
- func (c *Client) GetModelEvaluation(ctx context.Context, req *automlpb.GetModelEvaluationRequest, ...) (*automlpb.ModelEvaluation, error)
- func (c *Client) GetTableSpec(ctx context.Context, req *automlpb.GetTableSpecRequest, opts ...gax.CallOption) (*automlpb.TableSpec, error)
- func (c *Client) ImportData(ctx context.Context, req *automlpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error)
- func (c *Client) ImportDataOperation(name string) *ImportDataOperation
- func (c *Client) ListColumnSpecs(ctx context.Context, req *automlpb.ListColumnSpecsRequest, ...) *ColumnSpecIterator
- func (c *Client) ListDatasets(ctx context.Context, req *automlpb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator
- func (c *Client) ListModelEvaluations(ctx context.Context, req *automlpb.ListModelEvaluationsRequest, ...) *ModelEvaluationIterator
- func (c *Client) ListModels(ctx context.Context, req *automlpb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator
- func (c *Client) ListTableSpecs(ctx context.Context, req *automlpb.ListTableSpecsRequest, ...) *TableSpecIterator
- func (c *Client) UndeployModel(ctx context.Context, req *automlpb.UndeployModelRequest, ...) (*UndeployModelOperation, error)
- func (c *Client) UndeployModelOperation(name string) *UndeployModelOperation
- func (c *Client) UpdateColumnSpec(ctx context.Context, req *automlpb.UpdateColumnSpecRequest, ...) (*automlpb.ColumnSpec, error)
- func (c *Client) UpdateDataset(ctx context.Context, req *automlpb.UpdateDatasetRequest, ...) (*automlpb.Dataset, error)
- func (c *Client) UpdateTableSpec(ctx context.Context, req *automlpb.UpdateTableSpecRequest, ...) (*automlpb.TableSpec, error)
- type ColumnSpecIterator
- type CreateModelOperation
- func (op *CreateModelOperation) Done() bool
- func (op *CreateModelOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *CreateModelOperation) Name() string
- func (op *CreateModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*automlpb.Model, error)
- func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*automlpb.Model, error)
- type DatasetIterator
- type DeleteDatasetOperation
- func (op *DeleteDatasetOperation) Done() bool
- func (op *DeleteDatasetOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *DeleteDatasetOperation) Name() string
- func (op *DeleteDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DeleteModelOperation
- func (op *DeleteModelOperation) Done() bool
- func (op *DeleteModelOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *DeleteModelOperation) Name() string
- func (op *DeleteModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DeployModelOperation
- func (op *DeployModelOperation) Done() bool
- func (op *DeployModelOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *DeployModelOperation) Name() string
- func (op *DeployModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeployModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ExportDataOperation
- func (op *ExportDataOperation) Done() bool
- func (op *ExportDataOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *ExportDataOperation) Name() string
- func (op *ExportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ExportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ExportEvaluatedExamplesOperation
- func (op *ExportEvaluatedExamplesOperation) Done() bool
- func (op *ExportEvaluatedExamplesOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *ExportEvaluatedExamplesOperation) Name() string
- func (op *ExportEvaluatedExamplesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ExportEvaluatedExamplesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ExportModelOperation
- func (op *ExportModelOperation) Done() bool
- func (op *ExportModelOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *ExportModelOperation) Name() string
- func (op *ExportModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ExportModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ImportDataOperation
- func (op *ImportDataOperation) Done() bool
- func (op *ImportDataOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *ImportDataOperation) Name() string
- func (op *ImportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ImportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ModelEvaluationIterator
- type ModelIterator
- type PredictionCallOptions
- type PredictionClient
- func (c *PredictionClient) BatchPredict(ctx context.Context, req *automlpb.BatchPredictRequest, opts ...gax.CallOption) (*BatchPredictOperation, error)
- func (c *PredictionClient) BatchPredictOperation(name string) *BatchPredictOperation
- func (c *PredictionClient) Close() error
- func (c *PredictionClient) Connection() *grpc.ClientConn
- func (c *PredictionClient) Predict(ctx context.Context, req *automlpb.PredictRequest, opts ...gax.CallOption) (*automlpb.PredictResponse, error)
- type TableSpecIterator
- type UndeployModelOperation
- func (op *UndeployModelOperation) Done() bool
- func (op *UndeployModelOperation) Metadata() (*automlpb.OperationMetadata, error)
- func (op *UndeployModelOperation) Name() string
- func (op *UndeployModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *UndeployModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Examples ¶
- Client.CreateDataset
- Client.CreateModel
- Client.DeleteDataset
- Client.DeleteModel
- Client.DeployModel
- Client.ExportData
- Client.ExportEvaluatedExamples
- Client.ExportModel
- Client.GetAnnotationSpec
- Client.GetColumnSpec
- Client.GetDataset
- Client.GetModel
- Client.GetModelEvaluation
- Client.GetTableSpec
- Client.ImportData
- Client.ListColumnSpecs
- Client.ListDatasets
- Client.ListModelEvaluations
- Client.ListModels
- Client.ListTableSpecs
- Client.UndeployModel
- Client.UpdateColumnSpec
- Client.UpdateDataset
- Client.UpdateTableSpec
- NewClient
- NewPredictionClient
- PredictionClient.BatchPredict
- PredictionClient.Predict
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type BatchPredictOperation ¶
type BatchPredictOperation struct {
// contains filtered or unexported fields
}
BatchPredictOperation manages a long-running operation from BatchPredict.
func (*BatchPredictOperation) Done ¶
func (op *BatchPredictOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchPredictOperation) Metadata ¶
func (op *BatchPredictOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchPredictOperation) Name ¶
func (op *BatchPredictOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchPredictOperation) Poll ¶
func (op *BatchPredictOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*automlpb.BatchPredictResult, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BatchPredictOperation) Wait ¶
func (op *BatchPredictOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*automlpb.BatchPredictResult, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type CallOptions ¶
type CallOptions struct { CreateDataset []gax.CallOption GetDataset []gax.CallOption ListDatasets []gax.CallOption UpdateDataset []gax.CallOption DeleteDataset []gax.CallOption ImportData []gax.CallOption ExportData []gax.CallOption GetAnnotationSpec []gax.CallOption GetTableSpec []gax.CallOption ListTableSpecs []gax.CallOption UpdateTableSpec []gax.CallOption GetColumnSpec []gax.CallOption ListColumnSpecs []gax.CallOption UpdateColumnSpec []gax.CallOption CreateModel []gax.CallOption GetModel []gax.CallOption ListModels []gax.CallOption DeleteModel []gax.CallOption DeployModel []gax.CallOption UndeployModel []gax.CallOption ExportModel []gax.CallOption ExportEvaluatedExamples []gax.CallOption GetModelEvaluation []gax.CallOption ListModelEvaluations []gax.CallOption }
CallOptions contains the retry settings for each method of Client.
type Client ¶
type Client struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *CallOptions // contains filtered or unexported fields }
Client is a client for interacting with Cloud AutoML API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewClient ¶
NewClient creates a new auto ml client.
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.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" ) func main() { ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection ¶
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*Client) CreateDataset ¶
func (c *Client) CreateDataset(ctx context.Context, req *automlpb.CreateDatasetRequest, opts ...gax.CallOption) (*automlpb.Dataset, error)
CreateDataset creates a dataset.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.CreateDatasetRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateDataset(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) CreateModel ¶
func (c *Client) CreateModel(ctx context.Context, req *automlpb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error)
CreateModel 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 ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.CreateModelRequest{ // TODO: Fill request struct fields. } op, err := c.CreateModel(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) CreateModelOperation ¶
func (c *Client) CreateModelOperation(name string) *CreateModelOperation
CreateModelOperation returns a new CreateModelOperation from a given name. The name must be that of a previously created CreateModelOperation, possibly from a different process.
func (*Client) DeleteDataset ¶
func (c *Client) DeleteDataset(ctx context.Context, req *automlpb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error)
DeleteDataset 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 ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.DeleteDatasetRequest{ // TODO: Fill request struct fields. } op, err := c.DeleteDataset(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) DeleteDatasetOperation ¶
func (c *Client) DeleteDatasetOperation(name string) *DeleteDatasetOperation
DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name. The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
func (*Client) DeleteModel ¶
func (c *Client) DeleteModel(ctx context.Context, req *automlpb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error)
DeleteModel deletes a model. Returns google.protobuf.Empty in the response field when it completes, and delete_details in the metadata field.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.DeleteModelRequest{ // TODO: Fill request struct fields. } op, err := c.DeleteModel(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) DeleteModelOperation ¶
func (c *Client) DeleteModelOperation(name string) *DeleteModelOperation
DeleteModelOperation returns a new DeleteModelOperation from a given name. The name must be that of a previously created DeleteModelOperation, possibly from a different process.
func (*Client) DeployModel ¶
func (c *Client) DeployModel(ctx context.Context, req *automlpb.DeployModelRequest, opts ...gax.CallOption) (*DeployModelOperation, error)
DeployModel deploys a model. If a model is already deployed, deploying it with the same parameters has no effect. Deploying with different parametrs (as e.g. changing
node_number) will reset the deployment state without pausing the model’s availability.
Only applicable for Text Classification, Image Object Detection , Tables, and Image Segmentation; all other domains manage deployment automatically.
Returns an empty response in the response field when it completes.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.DeployModelRequest{ // TODO: Fill request struct fields. } op, err := c.DeployModel(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) DeployModelOperation ¶
func (c *Client) DeployModelOperation(name string) *DeployModelOperation
DeployModelOperation returns a new DeployModelOperation from a given name. The name must be that of a previously created DeployModelOperation, possibly from a different process.
func (*Client) ExportData ¶
func (c *Client) ExportData(ctx context.Context, req *automlpb.ExportDataRequest, opts ...gax.CallOption) (*ExportDataOperation, error)
ExportData exports dataset’s data to the provided output location. Returns an empty response in the response field when it completes.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ExportDataRequest{ // TODO: Fill request struct fields. } op, err := c.ExportData(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) ExportDataOperation ¶
func (c *Client) ExportDataOperation(name string) *ExportDataOperation
ExportDataOperation returns a new ExportDataOperation from a given name. The name must be that of a previously created ExportDataOperation, possibly from a different process.
func (*Client) ExportEvaluatedExamples ¶
func (c *Client) ExportEvaluatedExamples(ctx context.Context, req *automlpb.ExportEvaluatedExamplesRequest, opts ...gax.CallOption) (*ExportEvaluatedExamplesOperation, error)
ExportEvaluatedExamples 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 ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ExportEvaluatedExamplesRequest{ // TODO: Fill request struct fields. } op, err := c.ExportEvaluatedExamples(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) ExportEvaluatedExamplesOperation ¶
func (c *Client) ExportEvaluatedExamplesOperation(name string) *ExportEvaluatedExamplesOperation
ExportEvaluatedExamplesOperation returns a new ExportEvaluatedExamplesOperation from a given name. The name must be that of a previously created ExportEvaluatedExamplesOperation, possibly from a different process.
func (*Client) ExportModel ¶
func (c *Client) ExportModel(ctx context.Context, req *automlpb.ExportModelRequest, opts ...gax.CallOption) (*ExportModelOperation, error)
ExportModel 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 ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ExportModelRequest{ // TODO: Fill request struct fields. } op, err := c.ExportModel(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) ExportModelOperation ¶
func (c *Client) ExportModelOperation(name string) *ExportModelOperation
ExportModelOperation returns a new ExportModelOperation from a given name. The name must be that of a previously created ExportModelOperation, possibly from a different process.
func (*Client) GetAnnotationSpec ¶
func (c *Client) GetAnnotationSpec(ctx context.Context, req *automlpb.GetAnnotationSpecRequest, opts ...gax.CallOption) (*automlpb.AnnotationSpec, error)
GetAnnotationSpec gets an annotation spec.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.GetAnnotationSpecRequest{ // TODO: Fill request struct fields. } resp, err := c.GetAnnotationSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetColumnSpec ¶
func (c *Client) GetColumnSpec(ctx context.Context, req *automlpb.GetColumnSpecRequest, opts ...gax.CallOption) (*automlpb.ColumnSpec, error)
GetColumnSpec gets a column spec.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.GetColumnSpecRequest{ // TODO: Fill request struct fields. } resp, err := c.GetColumnSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetDataset ¶
func (c *Client) GetDataset(ctx context.Context, req *automlpb.GetDatasetRequest, opts ...gax.CallOption) (*automlpb.Dataset, error)
GetDataset gets a dataset.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.GetDatasetRequest{ // TODO: Fill request struct fields. } resp, err := c.GetDataset(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetModel ¶
func (c *Client) GetModel(ctx context.Context, req *automlpb.GetModelRequest, opts ...gax.CallOption) (*automlpb.Model, error)
GetModel gets a model.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.GetModelRequest{ // TODO: Fill request struct fields. } resp, err := c.GetModel(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetModelEvaluation ¶
func (c *Client) GetModelEvaluation(ctx context.Context, req *automlpb.GetModelEvaluationRequest, opts ...gax.CallOption) (*automlpb.ModelEvaluation, error)
GetModelEvaluation gets a model evaluation.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.GetModelEvaluationRequest{ // TODO: Fill request struct fields. } resp, err := c.GetModelEvaluation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetTableSpec ¶
func (c *Client) GetTableSpec(ctx context.Context, req *automlpb.GetTableSpecRequest, opts ...gax.CallOption) (*automlpb.TableSpec, error)
GetTableSpec gets a table spec.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.GetTableSpecRequest{ // TODO: Fill request struct fields. } resp, err := c.GetTableSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) ImportData ¶
func (c *Client) ImportData(ctx context.Context, req *automlpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error)
ImportData 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 ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ImportDataRequest{ // TODO: Fill request struct fields. } op, err := c.ImportData(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) ImportDataOperation ¶
func (c *Client) ImportDataOperation(name string) *ImportDataOperation
ImportDataOperation returns a new ImportDataOperation from a given name. The name must be that of a previously created ImportDataOperation, possibly from a different process.
func (*Client) ListColumnSpecs ¶
func (c *Client) ListColumnSpecs(ctx context.Context, req *automlpb.ListColumnSpecsRequest, opts ...gax.CallOption) *ColumnSpecIterator
ListColumnSpecs lists column specs in a table spec.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" "google.golang.org/api/iterator" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ListColumnSpecsRequest{ // TODO: Fill request struct fields. } it := c.ListColumnSpecs(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListDatasets ¶
func (c *Client) ListDatasets(ctx context.Context, req *automlpb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator
ListDatasets lists datasets in a project.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" "google.golang.org/api/iterator" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ListDatasetsRequest{ // TODO: Fill request struct fields. } it := c.ListDatasets(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListModelEvaluations ¶
func (c *Client) ListModelEvaluations(ctx context.Context, req *automlpb.ListModelEvaluationsRequest, opts ...gax.CallOption) *ModelEvaluationIterator
ListModelEvaluations lists model evaluations.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" "google.golang.org/api/iterator" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ListModelEvaluationsRequest{ // TODO: Fill request struct fields. } it := c.ListModelEvaluations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListModels ¶
func (c *Client) ListModels(ctx context.Context, req *automlpb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator
ListModels lists models.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" "google.golang.org/api/iterator" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ListModelsRequest{ // TODO: Fill request struct fields. } it := c.ListModels(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListTableSpecs ¶
func (c *Client) ListTableSpecs(ctx context.Context, req *automlpb.ListTableSpecsRequest, opts ...gax.CallOption) *TableSpecIterator
ListTableSpecs lists table specs in a dataset.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" "google.golang.org/api/iterator" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.ListTableSpecsRequest{ // TODO: Fill request struct fields. } it := c.ListTableSpecs(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) UndeployModel ¶
func (c *Client) UndeployModel(ctx context.Context, req *automlpb.UndeployModelRequest, opts ...gax.CallOption) (*UndeployModelOperation, error)
UndeployModel 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 ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.UndeployModelRequest{ // TODO: Fill request struct fields. } op, err := c.UndeployModel(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) UndeployModelOperation ¶
func (c *Client) UndeployModelOperation(name string) *UndeployModelOperation
UndeployModelOperation returns a new UndeployModelOperation from a given name. The name must be that of a previously created UndeployModelOperation, possibly from a different process.
func (*Client) UpdateColumnSpec ¶
func (c *Client) UpdateColumnSpec(ctx context.Context, req *automlpb.UpdateColumnSpecRequest, opts ...gax.CallOption) (*automlpb.ColumnSpec, error)
UpdateColumnSpec updates a column spec.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.UpdateColumnSpecRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateColumnSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateDataset ¶
func (c *Client) UpdateDataset(ctx context.Context, req *automlpb.UpdateDatasetRequest, opts ...gax.CallOption) (*automlpb.Dataset, error)
UpdateDataset updates a dataset.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.UpdateDatasetRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateDataset(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateTableSpec ¶
func (c *Client) UpdateTableSpec(ctx context.Context, req *automlpb.UpdateTableSpecRequest, opts ...gax.CallOption) (*automlpb.TableSpec, error)
UpdateTableSpec updates a table spec.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.UpdateTableSpecRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateTableSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type ColumnSpecIterator ¶
type ColumnSpecIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*automlpb.ColumnSpec, nextPageToken string, err error) // contains filtered or unexported fields }
ColumnSpecIterator manages a stream of *automlpb.ColumnSpec.
func (*ColumnSpecIterator) Next ¶
func (it *ColumnSpecIterator) Next() (*automlpb.ColumnSpec, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ColumnSpecIterator) PageInfo ¶
func (it *ColumnSpecIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type CreateModelOperation ¶
type CreateModelOperation struct {
// contains filtered or unexported fields
}
CreateModelOperation manages a long-running operation from CreateModel.
func (*CreateModelOperation) Done ¶
func (op *CreateModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateModelOperation) Metadata ¶
func (op *CreateModelOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateModelOperation) Name ¶
func (op *CreateModelOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateModelOperation) Poll ¶
func (op *CreateModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*automlpb.Model, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateModelOperation) Wait ¶
func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*automlpb.Model, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DatasetIterator ¶
type DatasetIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*automlpb.Dataset, nextPageToken string, err error) // contains filtered or unexported fields }
DatasetIterator manages a stream of *automlpb.Dataset.
func (*DatasetIterator) Next ¶
func (it *DatasetIterator) Next() (*automlpb.Dataset, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*DatasetIterator) PageInfo ¶
func (it *DatasetIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type DeleteDatasetOperation ¶
type DeleteDatasetOperation struct {
// contains filtered or unexported fields
}
DeleteDatasetOperation manages a long-running operation from DeleteDataset.
func (*DeleteDatasetOperation) Done ¶
func (op *DeleteDatasetOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteDatasetOperation) Metadata ¶
func (op *DeleteDatasetOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteDatasetOperation) Name ¶
func (op *DeleteDatasetOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteDatasetOperation) Poll ¶
func (op *DeleteDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteDatasetOperation) Wait ¶
func (op *DeleteDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DeleteModelOperation ¶
type DeleteModelOperation struct {
// contains filtered or unexported fields
}
DeleteModelOperation manages a long-running operation from DeleteModel.
func (*DeleteModelOperation) Done ¶
func (op *DeleteModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteModelOperation) Metadata ¶
func (op *DeleteModelOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteModelOperation) Name ¶
func (op *DeleteModelOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteModelOperation) Poll ¶
func (op *DeleteModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteModelOperation) Wait ¶
func (op *DeleteModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DeployModelOperation ¶
type DeployModelOperation struct {
// contains filtered or unexported fields
}
DeployModelOperation manages a long-running operation from DeployModel.
func (*DeployModelOperation) Done ¶
func (op *DeployModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeployModelOperation) Metadata ¶
func (op *DeployModelOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeployModelOperation) Name ¶
func (op *DeployModelOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeployModelOperation) Poll ¶
func (op *DeployModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeployModelOperation) Wait ¶
func (op *DeployModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ExportDataOperation ¶
type ExportDataOperation struct {
// contains filtered or unexported fields
}
ExportDataOperation manages a long-running operation from ExportData.
func (*ExportDataOperation) Done ¶
func (op *ExportDataOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportDataOperation) Metadata ¶
func (op *ExportDataOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ExportDataOperation) Name ¶
func (op *ExportDataOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportDataOperation) Poll ¶
func (op *ExportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportDataOperation) Wait ¶
func (op *ExportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ExportEvaluatedExamplesOperation ¶
type ExportEvaluatedExamplesOperation struct {
// contains filtered or unexported fields
}
ExportEvaluatedExamplesOperation manages a long-running operation from ExportEvaluatedExamples.
func (*ExportEvaluatedExamplesOperation) Done ¶
func (op *ExportEvaluatedExamplesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportEvaluatedExamplesOperation) Metadata ¶
func (op *ExportEvaluatedExamplesOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ExportEvaluatedExamplesOperation) Name ¶
func (op *ExportEvaluatedExamplesOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportEvaluatedExamplesOperation) Poll ¶
func (op *ExportEvaluatedExamplesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportEvaluatedExamplesOperation) Wait ¶
func (op *ExportEvaluatedExamplesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ExportModelOperation ¶
type ExportModelOperation struct {
// contains filtered or unexported fields
}
ExportModelOperation manages a long-running operation from ExportModel.
func (*ExportModelOperation) Done ¶
func (op *ExportModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportModelOperation) Metadata ¶
func (op *ExportModelOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ExportModelOperation) Name ¶
func (op *ExportModelOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportModelOperation) Poll ¶
func (op *ExportModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportModelOperation) Wait ¶
func (op *ExportModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ImportDataOperation ¶
type ImportDataOperation struct {
// contains filtered or unexported fields
}
ImportDataOperation manages a long-running operation from ImportData.
func (*ImportDataOperation) Done ¶
func (op *ImportDataOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportDataOperation) Metadata ¶
func (op *ImportDataOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportDataOperation) Name ¶
func (op *ImportDataOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportDataOperation) Poll ¶
func (op *ImportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportDataOperation) Wait ¶
func (op *ImportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ModelEvaluationIterator ¶
type ModelEvaluationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*automlpb.ModelEvaluation, nextPageToken string, err error) // contains filtered or unexported fields }
ModelEvaluationIterator manages a stream of *automlpb.ModelEvaluation.
func (*ModelEvaluationIterator) Next ¶
func (it *ModelEvaluationIterator) Next() (*automlpb.ModelEvaluation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ModelEvaluationIterator) PageInfo ¶
func (it *ModelEvaluationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ModelIterator ¶
type ModelIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*automlpb.Model, nextPageToken string, err error) // contains filtered or unexported fields }
ModelIterator manages a stream of *automlpb.Model.
func (*ModelIterator) Next ¶
func (it *ModelIterator) Next() (*automlpb.Model, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ModelIterator) PageInfo ¶
func (it *ModelIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type PredictionCallOptions ¶
type PredictionCallOptions struct { Predict []gax.CallOption BatchPredict []gax.CallOption }
PredictionCallOptions contains the retry settings for each method of PredictionClient.
type PredictionClient ¶
type PredictionClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *PredictionCallOptions // contains filtered or unexported fields }
PredictionClient is a client for interacting with Cloud AutoML API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewPredictionClient ¶
func NewPredictionClient(ctx context.Context, opts ...option.ClientOption) (*PredictionClient, error)
NewPredictionClient creates a new prediction service client.
AutoML Prediction API.
On any input that is documented to expect a string parameter in snake_case or kebab-case, either of those cases is accepted.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" ) func main() { ctx := context.Background() c, err := automl.NewPredictionClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*PredictionClient) BatchPredict ¶
func (c *PredictionClient) BatchPredict(ctx context.Context, req *automlpb.BatchPredictRequest, opts ...gax.CallOption) (*BatchPredictOperation, error)
BatchPredict perform a batch prediction. Unlike the online Predict, batch prediction result won’t be immediately available in the response. Instead, a long running operation object is returned. User can poll the operation result via GetOperation method. Once the operation is done, BatchPredictResult is returned in the response field. Available for following ML problems:
Image Classification Image Object Detection Video Classification Video Object Tracking * Text Extraction Tables
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewPredictionClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.BatchPredictRequest{ // TODO: Fill request struct fields. } op, err := c.BatchPredict(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*PredictionClient) BatchPredictOperation ¶
func (c *PredictionClient) BatchPredictOperation(name string) *BatchPredictOperation
BatchPredictOperation returns a new BatchPredictOperation from a given name. The name must be that of a previously created BatchPredictOperation, possibly from a different process.
func (*PredictionClient) Close ¶
func (c *PredictionClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*PredictionClient) Connection ¶
func (c *PredictionClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*PredictionClient) Predict ¶
func (c *PredictionClient) Predict(ctx context.Context, req *automlpb.PredictRequest, opts ...gax.CallOption) (*automlpb.PredictResponse, error)
Predict perform an online prediction. The prediction result will be directly returned in the response. Available for following ML problems, and their expected request payloads:
Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB. Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB. Text Classification - TextSnippet, content up to 60,000 characters, UTF-8 encoded. Text Extraction - TextSnippet, content up to 30,000 characters, UTF-8 NFC encoded. Translation - TextSnippet, content up to 25,000 characters, UTF-8 encoded. Tables - Row, with column values matching the columns of the model, up to 5MB. Not available for FORECASTING
prediction_type.
Text Sentiment - TextSnippet, content up 500 characters, UTF-8 encoded.
Example ¶
package main import ( "context" automl "cloud.google.com/go/automl/apiv1beta1" automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ) func main() { // import automlpb "google.golang.org/genproto/googleapis/cloud/automl/v1beta1" ctx := context.Background() c, err := automl.NewPredictionClient(ctx) if err != nil { // TODO: Handle error. } req := &automlpb.PredictRequest{ // TODO: Fill request struct fields. } resp, err := c.Predict(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type TableSpecIterator ¶
type TableSpecIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*automlpb.TableSpec, nextPageToken string, err error) // contains filtered or unexported fields }
TableSpecIterator manages a stream of *automlpb.TableSpec.
func (*TableSpecIterator) Next ¶
func (it *TableSpecIterator) Next() (*automlpb.TableSpec, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*TableSpecIterator) PageInfo ¶
func (it *TableSpecIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type UndeployModelOperation ¶
type UndeployModelOperation struct {
// contains filtered or unexported fields
}
UndeployModelOperation manages a long-running operation from UndeployModel.
func (*UndeployModelOperation) Done ¶
func (op *UndeployModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UndeployModelOperation) Metadata ¶
func (op *UndeployModelOperation) Metadata() (*automlpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UndeployModelOperation) Name ¶
func (op *UndeployModelOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UndeployModelOperation) Poll ¶
func (op *UndeployModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UndeployModelOperation) Wait ¶
func (op *UndeployModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.