go: cloud.google.com/go/automl/apiv1 Index | Examples | Files

package automl

import "cloud.google.com/go/automl/apiv1"

Train high-quality custom machine learning models with minimum effort and machine learning expertise.

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 godoc.org/cloud.google.com/go.

Index

Examples

Package Files

auto_ml_client.go doc.go prediction_client.go

func DefaultAuthScopes Uses

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

type BatchPredictOperation Uses

type BatchPredictOperation struct {
    // contains filtered or unexported fields
}

BatchPredictOperation manages a long-running operation from BatchPredict.

func (*BatchPredictOperation) Done Uses

func (op *BatchPredictOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*BatchPredictOperation) Metadata Uses

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 Uses

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 Uses

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 Uses

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 Uses

type CallOptions struct {
    CreateDataset        []gax.CallOption
    UpdateDataset        []gax.CallOption
    GetDataset           []gax.CallOption
    ListDatasets         []gax.CallOption
    DeleteDataset        []gax.CallOption
    ImportData           []gax.CallOption
    ExportData           []gax.CallOption
    GetAnnotationSpec    []gax.CallOption
    CreateModel          []gax.CallOption
    GetModel             []gax.CallOption
    UpdateModel          []gax.CallOption
    ListModels           []gax.CallOption
    DeleteModel          []gax.CallOption
    DeployModel          []gax.CallOption
    UndeployModel        []gax.CallOption
    ExportModel          []gax.CallOption
    GetModelEvaluation   []gax.CallOption
    ListModelEvaluations []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

type Client Uses

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 Uses

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

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.

Code:

ctx := context.Background()
c, err := automl.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use client.
_ = c

func (*Client) Close Uses

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) Connection Uses

func (c *Client) Connection() *grpc.ClientConn

Connection returns the client's connection to the API service.

func (*Client) CreateDataset Uses

func (c *Client) CreateDataset(ctx context.Context, req *automlpb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error)

CreateDataset creates a dataset.

Code:

ctx := context.Background()
c, err := automl.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}

req := &automlpb.CreateDatasetRequest{
    // TODO: Fill request struct fields.
}
op, err := c.CreateDataset(ctx, req)
if err != nil {
    // TODO: Handle error.
}

resp, err := op.Wait(ctx)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*Client) CreateDatasetOperation Uses

func (c *Client) CreateDatasetOperation(name string) *CreateDatasetOperation

CreateDatasetOperation returns a new CreateDatasetOperation from a given name. The name must be that of a previously created CreateDatasetOperation, possibly from a different process.

func (*Client) CreateModel Uses

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][google.longrunning.Operation.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.

Code:

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

func (*Client) CreateModelOperation Uses

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 Uses

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][google.longrunning.Operation.response] field when it completes, and delete_details in the [metadata][google.longrunning.Operation.metadata] field.

Code:

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)
// TODO: Handle error.

func (*Client) DeleteDatasetOperation Uses

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 Uses

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][google.longrunning.Operation.response] field when it completes, and delete_details in the [metadata][google.longrunning.Operation.metadata] field.

Code:

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)
// TODO: Handle error.

func (*Client) DeleteModelOperation Uses

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 Uses

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][google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata.node_number]) will reset the deployment state without pausing the model's availability.

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

Returns an empty response in the [response][google.longrunning.Operation.response] field when it completes.

Code:

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)
// TODO: Handle error.

func (*Client) DeployModelOperation Uses

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 Uses

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][google.longrunning.Operation.response] field when it completes.

Code:

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)
// TODO: Handle error.

func (*Client) ExportDataOperation Uses

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) ExportModel Uses

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][google.cloud.automl.v1.ModelExportOutputConfig].

Returns an empty response in the [response][google.longrunning.Operation.response] field when it completes.

Code:

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)
// TODO: Handle error.

func (*Client) ExportModelOperation Uses

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 Uses

func (c *Client) GetAnnotationSpec(ctx context.Context, req *automlpb.GetAnnotationSpecRequest, opts ...gax.CallOption) (*automlpb.AnnotationSpec, error)

GetAnnotationSpec gets an annotation spec.

Code:

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

func (*Client) GetDataset Uses

func (c *Client) GetDataset(ctx context.Context, req *automlpb.GetDatasetRequest, opts ...gax.CallOption) (*automlpb.Dataset, error)

GetDataset gets a dataset.

Code:

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

func (*Client) GetModel Uses

func (c *Client) GetModel(ctx context.Context, req *automlpb.GetModelRequest, opts ...gax.CallOption) (*automlpb.Model, error)

GetModel gets a model.

Code:

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

func (*Client) GetModelEvaluation Uses

func (c *Client) GetModelEvaluation(ctx context.Context, req *automlpb.GetModelEvaluationRequest, opts ...gax.CallOption) (*automlpb.ModelEvaluation, error)

GetModelEvaluation gets a model evaluation.

Code:

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

func (*Client) ImportData Uses

func (c *Client) ImportData(ctx context.Context, req *automlpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error)

ImportData imports data into a dataset.

Code:

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)
// TODO: Handle error.

func (*Client) ImportDataOperation Uses

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) ListDatasets Uses

func (c *Client) ListDatasets(ctx context.Context, req *automlpb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator

ListDatasets lists datasets in a project.

Code:

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
}

func (*Client) ListModelEvaluations Uses

func (c *Client) ListModelEvaluations(ctx context.Context, req *automlpb.ListModelEvaluationsRequest, opts ...gax.CallOption) *ModelEvaluationIterator

ListModelEvaluations lists model evaluations.

Code:

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
}

func (*Client) ListModels Uses

func (c *Client) ListModels(ctx context.Context, req *automlpb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator

ListModels lists models.

Code:

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
}

func (*Client) UndeployModel Uses

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

Returns an empty response in the [response][google.longrunning.Operation.response] field when it completes.

Code:

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)
// TODO: Handle error.

func (*Client) UndeployModelOperation Uses

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) UpdateDataset Uses

func (c *Client) UpdateDataset(ctx context.Context, req *automlpb.UpdateDatasetRequest, opts ...gax.CallOption) (*automlpb.Dataset, error)

UpdateDataset updates a dataset.

Code:

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

func (*Client) UpdateModel Uses

func (c *Client) UpdateModel(ctx context.Context, req *automlpb.UpdateModelRequest, opts ...gax.CallOption) (*automlpb.Model, error)

UpdateModel updates a model.

Code:

ctx := context.Background()
c, err := automl.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}

req := &automlpb.UpdateModelRequest{
    // TODO: Fill request struct fields.
}
resp, err := c.UpdateModel(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

type CreateDatasetOperation Uses

type CreateDatasetOperation struct {
    // contains filtered or unexported fields
}

CreateDatasetOperation manages a long-running operation from CreateDataset.

func (*CreateDatasetOperation) Done Uses

func (op *CreateDatasetOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateDatasetOperation) Metadata Uses

func (op *CreateDatasetOperation) 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 (*CreateDatasetOperation) Name Uses

func (op *CreateDatasetOperation) 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 (*CreateDatasetOperation) Poll Uses

func (op *CreateDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*automlpb.Dataset, 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 (*CreateDatasetOperation) Wait Uses

func (op *CreateDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*automlpb.Dataset, 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 CreateModelOperation Uses

type CreateModelOperation struct {
    // contains filtered or unexported fields
}

CreateModelOperation manages a long-running operation from CreateModel.

func (*CreateModelOperation) Done Uses

func (op *CreateModelOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateModelOperation) Metadata Uses

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 Uses

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 Uses

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 Uses

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 Uses

type DatasetIterator struct {

    // 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 Uses

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 Uses

func (it *DatasetIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type DeleteDatasetOperation Uses

type DeleteDatasetOperation struct {
    // contains filtered or unexported fields
}

DeleteDatasetOperation manages a long-running operation from DeleteDataset.

func (*DeleteDatasetOperation) Done Uses

func (op *DeleteDatasetOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteDatasetOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*DeleteDatasetOperation) Wait Uses

func (op *DeleteDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

type DeleteModelOperation Uses

type DeleteModelOperation struct {
    // contains filtered or unexported fields
}

DeleteModelOperation manages a long-running operation from DeleteModel.

func (*DeleteModelOperation) Done Uses

func (op *DeleteModelOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteModelOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*DeleteModelOperation) Wait Uses

func (op *DeleteModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

type DeployModelOperation Uses

type DeployModelOperation struct {
    // contains filtered or unexported fields
}

DeployModelOperation manages a long-running operation from DeployModel.

func (*DeployModelOperation) Done Uses

func (op *DeployModelOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeployModelOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*DeployModelOperation) Wait Uses

func (op *DeployModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

type ExportDataOperation Uses

type ExportDataOperation struct {
    // contains filtered or unexported fields
}

ExportDataOperation manages a long-running operation from ExportData.

func (*ExportDataOperation) Done Uses

func (op *ExportDataOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*ExportDataOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*ExportDataOperation) Wait Uses

func (op *ExportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

type ExportModelOperation Uses

type ExportModelOperation struct {
    // contains filtered or unexported fields
}

ExportModelOperation manages a long-running operation from ExportModel.

func (*ExportModelOperation) Done Uses

func (op *ExportModelOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*ExportModelOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*ExportModelOperation) Wait Uses

func (op *ExportModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

type ImportDataOperation Uses

type ImportDataOperation struct {
    // contains filtered or unexported fields
}

ImportDataOperation manages a long-running operation from ImportData.

func (*ImportDataOperation) Done Uses

func (op *ImportDataOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*ImportDataOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*ImportDataOperation) Wait Uses

func (op *ImportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

type ModelEvaluationIterator Uses

type ModelEvaluationIterator struct {

    // 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 Uses

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 Uses

func (it *ModelEvaluationIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type ModelIterator Uses

type ModelIterator struct {

    // 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 Uses

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 Uses

func (it *ModelIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type PredictionCallOptions Uses

type PredictionCallOptions struct {
    Predict      []gax.CallOption
    BatchPredict []gax.CallOption
}

PredictionCallOptions contains the retry settings for each method of PredictionClient.

type PredictionClient Uses

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 Uses

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.

Code:

ctx := context.Background()
c, err := automl.NewPredictionClient(ctx)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use client.
_ = c

func (*PredictionClient) BatchPredict Uses

func (c *PredictionClient) BatchPredict(ctx context.Context, req *automlpb.BatchPredictRequest, opts ...gax.CallOption) (*BatchPredictOperation, error)

BatchPredict perform a batch prediction. Unlike the online [Predict][google.cloud.automl.v1.PredictionService.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][google.longrunning.Operations.GetOperation] method. Once the operation is done, [BatchPredictResult][google.cloud.automl.v1.BatchPredictResult] is returned in the [response][google.longrunning.Operation.response] field. Available for following ML problems:

Image Classification

Image Object Detection

Text Extraction

Code:

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

func (*PredictionClient) BatchPredictOperation Uses

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 Uses

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 Uses

func (c *PredictionClient) Connection() *grpc.ClientConn

Connection returns the client's connection to the API service.

func (*PredictionClient) Predict Uses

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.

Text Sentiment - TextSnippet, content up 500 characters, UTF-8
encoded.

Code:

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

type UndeployModelOperation Uses

type UndeployModelOperation struct {
    // contains filtered or unexported fields
}

UndeployModelOperation manages a long-running operation from UndeployModel.

func (*UndeployModelOperation) Done Uses

func (op *UndeployModelOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UndeployModelOperation) Metadata Uses

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 Uses

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 Uses

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.

func (*UndeployModelOperation) Wait Uses

func (op *UndeployModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error

Wait blocks until the long-running operation is completed, returning any error encountered.

See documentation of Poll for error-handling information.

Package automl imports 20 packages (graph). Updated 2019-12-14. Refresh now. Tools for package owners.