Skip to content

Commit

Permalink
feat: v1 API surface added (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored Oct 4, 2019
1 parent 3cfdf2f commit 7d31aa8
Show file tree
Hide file tree
Showing 38 changed files with 20,379 additions and 326 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.automl.v1;

import "google/cloud/automl/v1/translation.proto";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
option csharp_namespace = "Google.Cloud.AutoML.V1";
option java_multiple_files = true;
option java_package = "com.google.cloud.automl.v1";
option php_namespace = "Google\\Cloud\\AutoML\\V1";
option ruby_package = "Google::Cloud::AutoML::V1";

// Contains annotation information that is relevant to AutoML.
message AnnotationPayload {
// Output only . Additional information about the annotation
// specific to the AutoML domain.
oneof detail {
// Annotation details for translation.
TranslationAnnotation translation = 2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.automl.v1;

import "google/cloud/automl/v1/io.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
option csharp_namespace = "Google.Cloud.AutoML.V1";
option java_multiple_files = true;
option java_package = "com.google.cloud.automl.v1";
option php_namespace = "Google\\Cloud\\AutoML\\V1";
option ruby_package = "Google::Cloud::AutoML::V1";

// A representation of a text snippet.
message TextSnippet {
// Required. The content of the text snippet as a string. Up to 250000
// characters long.
string content = 1;

// Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed
// values are "text/html" and "text/plain". If left blank, the format is
// automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content].
string mime_type = 2;

// Output only. HTTP URI where you can download the content.
string content_uri = 4;
}

// Example data used for training or prediction.
message ExamplePayload {
// Required. Input only. The example data.
oneof payload {
// Example text.
TextSnippet text_snippet = 2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.automl.v1;

import "google/cloud/automl/v1/translation.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
option csharp_namespace = "Google.Cloud.AutoML.V1";
option java_multiple_files = true;
option java_package = "com.google.cloud.automl.v1";
option php_namespace = "Google\\Cloud\\AutoML\\V1";
option ruby_package = "Google::Cloud::AutoML::V1";

// A workspace for solving a single, particular machine learning (ML) problem.
// A workspace contains examples that may be annotated.
message Dataset {
// Required.
// The dataset metadata that is specific to the problem type.
oneof dataset_metadata {
// Metadata for a dataset used for translation.
TranslationDatasetMetadata translation_dataset_metadata = 23;
}

// Output only. The resource name of the dataset.
// Form: `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`
string name = 1;

// Required. The name of the dataset to show in the interface. The name can be
// up to 32 characters long and can consist only of ASCII Latin letters A-Z
// and a-z, underscores
// (_), and ASCII digits 0-9.
string display_name = 2;

// User-provided description of the dataset. The description can be up to
// 25000 characters long.
string description = 3;

// Output only. The number of examples in the dataset.
int32 example_count = 21;

// Output only. Timestamp when this dataset was created.
google.protobuf.Timestamp create_time = 14;

// Used to perform consistent read-modify-write updates. If not set, a blind
// "overwrite" update happens.
string etag = 17;

// Optional. The labels with user-defined metadata to organize your dataset.
//
// Label keys and values can be no longer than 64 characters
// (Unicode codepoints), can only contain lowercase letters, numeric
// characters, underscores and dashes. International characters are allowed.
// Label values are optional. Label keys must start with a letter.
//
// See https://goo.gl/xmQnxf for more information on and examples of labels.
map<string, string> labels = 39;
}
109 changes: 109 additions & 0 deletions packages/google-cloud-automl/protos/google/cloud/automl/v1/io.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.automl.v1;

import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
option csharp_namespace = "Google.Cloud.AutoML.V1";
option java_multiple_files = true;
option java_package = "com.google.cloud.automl.v1";
option php_namespace = "Google\\Cloud\\AutoML\\V1";
option ruby_package = "Google::Cloud::AutoML::V1";

// Input configuration for ImportData Action.
//
// The format of input depends on dataset_metadata the Dataset into which
// the import is happening has. As input source the
// [gcs_source][google.cloud.automl.v1beta1.InputConfig.gcs_source]
// is expected, unless specified otherwise. Additionally any input .CSV file
// by itself must be 100MB or smaller, unless specified otherwise.
// If an "example" file (that is, image, video etc.) with identical content
// (even if it had different GCS_FILE_PATH) is mentioned multiple times, then
// its label, bounding boxes etc. are appended. The same file should be always
// provided with the same ML_USE and GCS_FILE_PATH, if it is not, then
// these values are nondeterministically selected from the given ones.
//
// Errors:
// If any of the provided CSV files can't be parsed or if more than certain
// percent of CSV rows cannot be processed then the operation fails and
// nothing is imported. Regardless of overall success or failure the per-row
// failures, up to a certain count cap, is listed in
// Operation.metadata.partial_failures.
//
message InputConfig {
// The source of the input.
oneof source {
// The Google Cloud Storage location for the input content.
// In ImportData, the gcs_source points to a csv with structure described in
// the comment.
GcsSource gcs_source = 1;
}

// Additional domain-specific parameters describing the semantic of the
// imported data, any string must be up to 25000
// characters long.
map<string, string> params = 2;
}

// * For Translation:
// CSV file `translation.csv`, with each line in format:
// ML_USE,GCS_FILE_PATH
// GCS_FILE_PATH leads to a .TSV file which describes examples that have
// given ML_USE, using the following row format per line:
// TEXT_SNIPPET (in source language) \t TEXT_SNIPPET (in target
// language)
//
// `export_data_<automl-dataset-display-name>_<timestamp-of-export-call>`
// where <automl-dataset-display-name> will be made
// BigQuery-dataset-name compatible (e.g. most special characters will
// become underscores), and timestamp will be in
// YYYY_MM_DDThh_mm_ss_sssZ "based on ISO-8601" format. In that
// dataset a new table called `primary_table` will be created, and
// filled with precisely the same data as this obtained on import.
message OutputConfig {
// Required. The destination of the output.
oneof destination {
// The Google Cloud Storage location where the output is to be written to.
// For Image Object Detection, Text Extraction, Video Classification and
// Tables, in the given directory a new directory will be created with name:
// export_data-<dataset-display-name>-<timestamp-of-export-call> where
// timestamp is in YYYY-MM-DDThh:mm:ss.sssZ ISO-8601 format. All export
// output will be written into that directory.
GcsDestination gcs_destination = 1;
}
}

// The Google Cloud Storage location for the input content.
message GcsSource {
// Required. Google Cloud Storage URIs to input files, up to 2000 characters
// long. Accepted forms:
// * Full object path, e.g. gs://bucket/directory/object.csv
repeated string input_uris = 1;
}

// The Google Cloud Storage location where the output is to be written to.
message GcsDestination {
// Required. Google Cloud Storage URI to output directory, up to 2000
// characters long.
// Accepted forms:
// * Prefix path: gs://bucket/directory
// The requesting user must have write permission to the bucket.
// The directory is created if it doesn't exist.
string output_uri_prefix = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.cloud.automl.v1;

import "google/cloud/automl/v1/translation.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
option csharp_namespace = "Google.Cloud.AutoML.V1";
option java_multiple_files = true;
option java_package = "com.google.cloud.automl.v1";
option php_namespace = "Google\\Cloud\\AutoML\\V1";
option ruby_package = "Google::Cloud::AutoML::V1";

// API proto representing a trained machine learning model.
message Model {
// Deployment state of the model.
enum DeploymentState {
// Should not be used, an un-set enum has this value by default.
DEPLOYMENT_STATE_UNSPECIFIED = 0;

// Model is deployed.
DEPLOYED = 1;

// Model is not deployed.
UNDEPLOYED = 2;
}

// Required.
// The model metadata that is specific to the problem type.
// Must match the metadata type of the dataset used to train the model.
oneof model_metadata {
// Metadata for translation models.
TranslationModelMetadata translation_model_metadata = 15;
}

// Output only. Resource name of the model.
// Format: `projects/{project_id}/locations/{location_id}/models/{model_id}`
string name = 1;

// Required. The name of the model to show in the interface. The name can be
// up to 32 characters long and can consist only of ASCII Latin letters A-Z
// and a-z, underscores
// (_), and ASCII digits 0-9. It must start with a letter.
string display_name = 2;

// Required. The resource ID of the dataset used to create the model. The dataset must
// come from the same ancestor project and location.
string dataset_id = 3;

// Output only. Timestamp when the model training finished and can be used for prediction.
google.protobuf.Timestamp create_time = 7;

// Output only. Timestamp when this model was last updated.
google.protobuf.Timestamp update_time = 11;

// Output only. Deployment state of the model. A model can only serve
// prediction requests after it gets deployed.
DeploymentState deployment_state = 8;

// Optional. The labels with user-defined metadata to organize your model.
//
// Label keys and values can be no longer than 64 characters
// (Unicode codepoints), can only contain lowercase letters, numeric
// characters, underscores and dashes. International characters are allowed.
// Label values are optional. Label keys must start with a letter.
//
// See https://goo.gl/xmQnxf for more information on and examples of labels.
map<string, string> labels = 34;
}
Loading

0 comments on commit 7d31aa8

Please sign in to comment.