Skip to content

Commit 6c4990b

Browse files
yoshi-automationcallmehiphop
authored andcommitted
feat: additional safe search confidence fields (#444)
1 parent 9a14b67 commit 6c4990b

12 files changed

+779
-362
lines changed

packages/google-cloud-vision/protos/google/cloud/vision/v1/image_annotator.proto

+68-35
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package google.cloud.vision.v1;
1919

2020
import "google/api/annotations.proto";
2121
import "google/api/client.proto";
22+
import "google/api/field_behavior.proto";
2223
import "google/cloud/vision/v1/geometry.proto";
2324
import "google/cloud/vision/v1/product_search.proto";
2425
import "google/cloud/vision/v1/text_annotation.proto";
@@ -47,8 +48,7 @@ service ImageAnnotator {
4748
"https://www.googleapis.com/auth/cloud-vision";
4849

4950
// Run image detection and annotation for a batch of images.
50-
rpc BatchAnnotateImages(BatchAnnotateImagesRequest)
51-
returns (BatchAnnotateImagesResponse) {
51+
rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) {
5252
option (google.api.http) = {
5353
post: "/v1/images:annotate"
5454
body: "*"
@@ -61,6 +61,7 @@ service ImageAnnotator {
6161
body: "*"
6262
}
6363
};
64+
option (google.api.method_signature) = "requests";
6465
}
6566

6667
// Service that performs image detection and annotation for a batch of files.
@@ -70,8 +71,7 @@ service ImageAnnotator {
7071
// AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
7172
// file provided and perform detection and annotation for each image
7273
// extracted.
73-
rpc BatchAnnotateFiles(BatchAnnotateFilesRequest)
74-
returns (BatchAnnotateFilesResponse) {
74+
rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) returns (BatchAnnotateFilesResponse) {
7575
option (google.api.http) = {
7676
post: "/v1/files:annotate"
7777
body: "*"
@@ -84,6 +84,7 @@ service ImageAnnotator {
8484
body: "*"
8585
}
8686
};
87+
option (google.api.method_signature) = "requests";
8788
}
8889

8990
// Run asynchronous image detection and annotation for a list of images.
@@ -95,8 +96,7 @@ service ImageAnnotator {
9596
//
9697
// This service will write image annotation outputs to json files in customer
9798
// GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
98-
rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest)
99-
returns (google.longrunning.Operation) {
99+
rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) returns (google.longrunning.Operation) {
100100
option (google.api.http) = {
101101
post: "/v1/images:asyncBatchAnnotate"
102102
body: "*"
@@ -109,6 +109,11 @@ service ImageAnnotator {
109109
body: "*"
110110
}
111111
};
112+
option (google.api.method_signature) = "requests,output_config";
113+
option (google.longrunning.operation_info) = {
114+
response_type: "AsyncBatchAnnotateImagesResponse"
115+
metadata_type: "OperationMetadata"
116+
};
112117
}
113118

114119
// Run asynchronous image detection and annotation for a list of generic
@@ -117,8 +122,7 @@ service ImageAnnotator {
117122
// `google.longrunning.Operations` interface.
118123
// `Operation.metadata` contains `OperationMetadata` (metadata).
119124
// `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
120-
rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest)
121-
returns (google.longrunning.Operation) {
125+
rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) {
122126
option (google.api.http) = {
123127
post: "/v1/files:asyncBatchAnnotate"
124128
body: "*"
@@ -131,6 +135,11 @@ service ImageAnnotator {
131135
body: "*"
132136
}
133137
};
138+
option (google.api.method_signature) = "requests";
139+
option (google.longrunning.operation_info) = {
140+
response_type: "AsyncBatchAnnotateFilesResponse"
141+
metadata_type: "OperationMetadata"
142+
};
134143
}
135144
}
136145

@@ -557,6 +566,30 @@ message SafeSearchAnnotation {
557566
// covered nudity, lewd or provocative poses, or close-ups of sensitive
558567
// body areas.
559568
Likelihood racy = 9;
569+
570+
// Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means
571+
// very confident.
572+
float adult_confidence = 16;
573+
574+
// Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means
575+
// very confident.
576+
float spoof_confidence = 18;
577+
578+
// Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means
579+
// very confident.
580+
float medical_confidence = 20;
581+
582+
// Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means
583+
// very confident.
584+
float violence_confidence = 22;
585+
586+
// Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very
587+
// confident.
588+
float racy_confidence = 24;
589+
590+
// Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very
591+
// confident.
592+
float nsfw_confidence = 26;
560593
}
561594

562595
// Rectangle determined by min and max `LatLng` pairs.
@@ -732,28 +765,10 @@ message AnnotateImageResponse {
732765
ImageAnnotationContext context = 21;
733766
}
734767

735-
// Response to a single file annotation request. A file may contain one or more
736-
// images, which individually have their own responses.
737-
message AnnotateFileResponse {
738-
// Information about the file for which this response is generated.
739-
InputConfig input_config = 1;
740-
741-
// Individual responses to images found within the file. This field will be
742-
// empty if the `error` field is set.
743-
repeated AnnotateImageResponse responses = 2;
744-
745-
// This field gives the total number of pages in the file.
746-
int32 total_pages = 3;
747-
748-
// If set, represents the error message for the failed request. The
749-
// `responses` field will not be set in this case.
750-
google.rpc.Status error = 4;
751-
}
752-
753768
// Multiple image annotation requests are batched into a single service call.
754769
message BatchAnnotateImagesRequest {
755-
// Individual image annotation requests for this batch.
756-
repeated AnnotateImageRequest requests = 1;
770+
// Required. Individual image annotation requests for this batch.
771+
repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
757772

758773
// Optional. Target project and location to make a call.
759774
//
@@ -804,11 +819,29 @@ message AnnotateFileRequest {
804819
repeated int32 pages = 4;
805820
}
806821

822+
// Response to a single file annotation request. A file may contain one or more
823+
// images, which individually have their own responses.
824+
message AnnotateFileResponse {
825+
// Information about the file for which this response is generated.
826+
InputConfig input_config = 1;
827+
828+
// Individual responses to images found within the file. This field will be
829+
// empty if the `error` field is set.
830+
repeated AnnotateImageResponse responses = 2;
831+
832+
// This field gives the total number of pages in the file.
833+
int32 total_pages = 3;
834+
835+
// If set, represents the error message for the failed request. The
836+
// `responses` field will not be set in this case.
837+
google.rpc.Status error = 4;
838+
}
839+
807840
// A list of requests to annotate files using the BatchAnnotateFiles API.
808841
message BatchAnnotateFilesRequest {
809-
// The list of file annotation requests. Right now we support only one
842+
// Required. The list of file annotation requests. Right now we support only one
810843
// AnnotateFileRequest in BatchAnnotateFilesRequest.
811-
repeated AnnotateFileRequest requests = 1;
844+
repeated AnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
812845

813846
// Optional. Target project and location to make a call.
814847
//
@@ -855,11 +888,11 @@ message AsyncAnnotateFileResponse {
855888

856889
// Request for async image annotation for a list of images.
857890
message AsyncBatchAnnotateImagesRequest {
858-
// Individual image annotation requests for this batch.
859-
repeated AnnotateImageRequest requests = 1;
891+
// Required. Individual image annotation requests for this batch.
892+
repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
860893

861894
// Required. The desired output location and metadata (e.g. format).
862-
OutputConfig output_config = 2;
895+
OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED];
863896

864897
// Optional. Target project and location to make a call.
865898
//
@@ -885,8 +918,8 @@ message AsyncBatchAnnotateImagesResponse {
885918
// Multiple async file annotation requests are batched into a single service
886919
// call.
887920
message AsyncBatchAnnotateFilesRequest {
888-
// Individual async file annotation requests for this batch.
889-
repeated AsyncAnnotateFileRequest requests = 1;
921+
// Required. Individual async file annotation requests for this batch.
922+
repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];
890923

891924
// Optional. Target project and location to make a call.
892925
//

packages/google-cloud-vision/protos/google/cloud/vision/v1/product_search.proto

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ syntax = "proto3";
1717

1818
package google.cloud.vision.v1;
1919

20-
import "google/api/annotations.proto";
2120
import "google/cloud/vision/v1/geometry.proto";
2221
import "google/cloud/vision/v1/product_search_service.proto";
2322
import "google/protobuf/timestamp.proto";
23+
import "google/api/annotations.proto";
2424

2525
option cc_enable_arenas = true;
2626
option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision";
@@ -35,8 +35,7 @@ message ProductSearchParams {
3535
// Optional. If it is not specified, system discretion will be applied.
3636
BoundingPoly bounding_poly = 9;
3737

38-
// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to
39-
// be searched for similar images.
38+
// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images.
4039
//
4140
// Format is:
4241
// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.

0 commit comments

Comments
 (0)