@@ -92,6 +92,15 @@ service LanguageService {
9292 option (google.api.method_signature ) = "document" ;
9393 }
9494
95+ // Moderates a document for harmful and sensitive categories.
96+ rpc ModerateText (ModerateTextRequest ) returns (ModerateTextResponse ) {
97+ option (google.api.http ) = {
98+ post : "/v1/documents:moderateText"
99+ body : "*"
100+ };
101+ option (google.api.method_signature ) = "document" ;
102+ }
103+
95104 // A convenience method that provides all the features that analyzeSentiment,
96105 // analyzeEntities, and analyzeSyntax provide in one call.
97106 rpc AnnotateText (AnnotateTextRequest ) returns (AnnotateTextResponse ) {
@@ -966,8 +975,7 @@ message TextSpan {
966975
967976// Represents a category returned from the text classifier.
968977message ClassificationCategory {
969- // The name of the category representing the document, from the [predefined
970- // taxonomy](https://cloud.google.com/natural-language/docs/categories).
978+ // The name of the category representing the document.
971979 string name = 1 ;
972980
973981 // The classifier's confidence of the category. Number represents how certain
@@ -1118,6 +1126,18 @@ message ClassifyTextResponse {
11181126 repeated ClassificationCategory categories = 1 ;
11191127}
11201128
1129+ // The document moderation request message.
1130+ message ModerateTextRequest {
1131+ // Required. Input document.
1132+ Document document = 1 [(google.api.field_behavior ) = REQUIRED ];
1133+ }
1134+
1135+ // The document moderation response message.
1136+ message ModerateTextResponse {
1137+ // Harmful and sensitive categories representing the input document.
1138+ repeated ClassificationCategory moderation_categories = 1 ;
1139+ }
1140+
11211141// The request message for the text annotation API, which can perform multiple
11221142// analysis types (sentiment, entities, and syntax) in one call.
11231143message AnnotateTextRequest {
@@ -1139,6 +1159,9 @@ message AnnotateTextRequest {
11391159 // Classify the full document into categories.
11401160 bool classify_text = 6 ;
11411161
1162+ // Moderate the document for harmful and sensitive categories.
1163+ bool moderate_text = 11 ;
1164+
11421165 // The model options to use for classification. Defaults to v1 options
11431166 // if not specified. Only used if `classify_text` is set to true.
11441167 ClassificationModelOptions classification_model_options = 10 ;
@@ -1182,4 +1205,7 @@ message AnnotateTextResponse {
11821205
11831206 // Categories identified in the input document.
11841207 repeated ClassificationCategory categories = 6 ;
1208+
1209+ // Harmful and sensitive categories identified in the input document.
1210+ repeated ClassificationCategory moderation_categories = 7 ;
11851211}
0 commit comments