diff --git a/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/client.rb b/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/client.rb index 2b5cbfa1d61a..966d042ee1b2 100644 --- a/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/client.rb +++ b/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/client.rb @@ -440,13 +440,15 @@ def classify_text request, options = nil # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # - # @overload moderate_text(document: nil) + # @overload moderate_text(document: nil, model_version: nil) # Pass arguments to `moderate_text` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param document [::Google::Cloud::Language::V2::Document, ::Hash] # Required. Input document. + # @param model_version [::Google::Cloud::Language::V2::ModerateTextRequest::ModelVersion] + # Optional. The model version to use for ModerateText. # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Cloud::Language::V2::ModerateTextResponse] diff --git a/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/rest/client.rb b/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/rest/client.rb index e405822e6399..ec958fa3eefa 100644 --- a/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/rest/client.rb +++ b/google-cloud-language-v2/lib/google/cloud/language/v2/language_service/rest/client.rb @@ -436,13 +436,15 @@ def classify_text request, options = nil # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # - # @overload moderate_text(document: nil) + # @overload moderate_text(document: nil, model_version: nil) # Pass arguments to `moderate_text` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). # # @param document [::Google::Cloud::Language::V2::Document, ::Hash] # Required. Input document. + # @param model_version [::Google::Cloud::Language::V2::ModerateTextRequest::ModelVersion] + # Optional. The model version to use for ModerateText. # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Language::V2::ModerateTextResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] diff --git a/google-cloud-language-v2/lib/google/cloud/language/v2/language_service_pb.rb b/google-cloud-language-v2/lib/google/cloud/language/v2/language_service_pb.rb index 51449cc99095..d4b10b746419 100644 --- a/google-cloud-language-v2/lib/google/cloud/language/v2/language_service_pb.rb +++ b/google-cloud-language-v2/lib/google/cloud/language/v2/language_service_pb.rb @@ -9,7 +9,7 @@ require 'google/api/field_behavior_pb' -descriptor_data = "\n/google/cloud/language/v2/language_service.proto\x12\x18google.cloud.language.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"\xcd\x01\n\x08\x44ocument\x12\x35\n\x04type\x18\x01 \x01(\x0e\x32\'.google.cloud.language.v2.Document.Type\x12\x11\n\x07\x63ontent\x18\x02 \x01(\tH\x00\x12\x19\n\x0fgcs_content_uri\x18\x03 \x01(\tH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\"6\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nPLAIN_TEXT\x10\x01\x12\x08\n\x04HTML\x10\x02\x42\x08\n\x06source\"t\n\x08Sentence\x12\x30\n\x04text\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.TextSpan\x12\x36\n\tsentiment\x18\x02 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\"\xed\x03\n\x06\x45ntity\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x04type\x18\x02 \x01(\x0e\x32%.google.cloud.language.v2.Entity.Type\x12@\n\x08metadata\x18\x03 \x03(\x0b\x32..google.cloud.language.v2.Entity.MetadataEntry\x12\x39\n\x08mentions\x18\x05 \x03(\x0b\x32\'.google.cloud.language.v2.EntityMention\x12\x36\n\tsentiment\x18\x06 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb9\x01\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06PERSON\x10\x01\x12\x0c\n\x08LOCATION\x10\x02\x12\x10\n\x0cORGANIZATION\x10\x03\x12\t\n\x05\x45VENT\x10\x04\x12\x0f\n\x0bWORK_OF_ART\x10\x05\x12\x11\n\rCONSUMER_GOOD\x10\x06\x12\t\n\x05OTHER\x10\x07\x12\x10\n\x0cPHONE_NUMBER\x10\t\x12\x0b\n\x07\x41\x44\x44RESS\x10\n\x12\x08\n\x04\x44\x41TE\x10\x0b\x12\n\n\x06NUMBER\x10\x0c\x12\t\n\x05PRICE\x10\r\"-\n\tSentiment\x12\x11\n\tmagnitude\x18\x01 \x01(\x02\x12\r\n\x05score\x18\x02 \x01(\x02\"\xfc\x01\n\rEntityMention\x12\x30\n\x04text\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.TextSpan\x12:\n\x04type\x18\x02 \x01(\x0e\x32,.google.cloud.language.v2.EntityMention.Type\x12\x36\n\tsentiment\x18\x03 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x13\n\x0bprobability\x18\x04 \x01(\x02\"0\n\x04Type\x12\x10\n\x0cTYPE_UNKNOWN\x10\x00\x12\n\n\x06PROPER\x10\x01\x12\n\n\x06\x43OMMON\x10\x02\"1\n\x08TextSpan\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x14\n\x0c\x62\x65gin_offset\x18\x02 \x01(\x05\":\n\x16\x43lassificationCategory\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\"\x93\x01\n\x17\x41nalyzeSentimentRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x02 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\"\xc5\x01\n\x18\x41nalyzeSentimentResponse\x12?\n\x12\x64ocument_sentiment\x18\x01 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x35\n\tsentences\x18\x03 \x03(\x0b\x32\".google.cloud.language.v2.Sentence\x12\x1a\n\x12language_supported\x18\x04 \x01(\x08\"\x92\x01\n\x16\x41nalyzeEntitiesRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x02 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\"\x80\x01\n\x17\x41nalyzeEntitiesResponse\x12\x32\n\x08\x65ntities\x18\x01 \x03(\x0b\x32 .google.cloud.language.v2.Entity\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"P\n\x13\x43lassifyTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\"\x8f\x01\n\x14\x43lassifyTextResponse\x12\x44\n\ncategories\x18\x01 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"P\n\x13ModerateTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\"\x9a\x01\n\x14ModerateTextResponse\x12O\n\x15moderation_categories\x18\x01 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"\xeb\x02\n\x13\x41nnotateTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12M\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x36.google.cloud.language.v2.AnnotateTextRequest.FeaturesB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x03 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\x1a\x8a\x01\n\x08\x46\x65\x61tures\x12\x1d\n\x10\x65xtract_entities\x18\x01 \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65xtract_document_sentiment\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rclassify_text\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rmoderate_text\x18\x05 \x01(\x08\x42\x03\xe0\x41\x01\"\x8c\x03\n\x14\x41nnotateTextResponse\x12\x35\n\tsentences\x18\x01 \x03(\x0b\x32\".google.cloud.language.v2.Sentence\x12\x32\n\x08\x65ntities\x18\x02 \x03(\x0b\x32 .google.cloud.language.v2.Entity\x12?\n\x12\x64ocument_sentiment\x18\x03 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x15\n\rlanguage_code\x18\x04 \x01(\t\x12\x44\n\ncategories\x18\x05 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12O\n\x15moderation_categories\x18\x06 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x1a\n\x12language_supported\x18\x07 \x01(\x08*8\n\x0c\x45ncodingType\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04UTF8\x10\x01\x12\t\n\x05UTF16\x10\x02\x12\t\n\x05UTF32\x10\x03\x32\xb0\x08\n\x0fLanguageService\x12\xc8\x01\n\x10\x41nalyzeSentiment\x12\x31.google.cloud.language.v2.AnalyzeSentimentRequest\x1a\x32.google.cloud.language.v2.AnalyzeSentimentResponse\"M\xda\x41\x16\x64ocument,encoding_type\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02#\"\x1e/v2/documents:analyzeSentiment:\x01*\x12\xc4\x01\n\x0f\x41nalyzeEntities\x12\x30.google.cloud.language.v2.AnalyzeEntitiesRequest\x1a\x31.google.cloud.language.v2.AnalyzeEntitiesResponse\"L\xda\x41\x16\x64ocument,encoding_type\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02\"\"\x1d/v2/documents:analyzeEntities:\x01*\x12\x9f\x01\n\x0c\x43lassifyText\x12-.google.cloud.language.v2.ClassifyTextRequest\x1a..google.cloud.language.v2.ClassifyTextResponse\"0\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:classifyText:\x01*\x12\x9f\x01\n\x0cModerateText\x12-.google.cloud.language.v2.ModerateTextRequest\x1a..google.cloud.language.v2.ModerateTextResponse\"0\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:moderateText:\x01*\x12\xca\x01\n\x0c\x41nnotateText\x12-.google.cloud.language.v2.AnnotateTextRequest\x1a..google.cloud.language.v2.AnnotateTextResponse\"[\xda\x41\x1f\x64ocument,features,encoding_type\xda\x41\x11\x64ocument,features\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:annotateText:\x01*\x1az\xca\x41\x17language.googleapis.com\xd2\x41]https://www.googleapis.com/auth/cloud-language,https://www.googleapis.com/auth/cloud-platformBp\n\x1c\x63om.google.cloud.language.v2B\x14LanguageServiceProtoP\x01Z8cloud.google.com/go/language/apiv2/languagepb;languagepbb\x06proto3" +descriptor_data = "\n/google/cloud/language/v2/language_service.proto\x12\x18google.cloud.language.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"\xcd\x01\n\x08\x44ocument\x12\x35\n\x04type\x18\x01 \x01(\x0e\x32\'.google.cloud.language.v2.Document.Type\x12\x11\n\x07\x63ontent\x18\x02 \x01(\tH\x00\x12\x19\n\x0fgcs_content_uri\x18\x03 \x01(\tH\x00\x12\x1a\n\rlanguage_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\"6\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nPLAIN_TEXT\x10\x01\x12\x08\n\x04HTML\x10\x02\x42\x08\n\x06source\"t\n\x08Sentence\x12\x30\n\x04text\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.TextSpan\x12\x36\n\tsentiment\x18\x02 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\"\xed\x03\n\x06\x45ntity\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x04type\x18\x02 \x01(\x0e\x32%.google.cloud.language.v2.Entity.Type\x12@\n\x08metadata\x18\x03 \x03(\x0b\x32..google.cloud.language.v2.Entity.MetadataEntry\x12\x39\n\x08mentions\x18\x05 \x03(\x0b\x32\'.google.cloud.language.v2.EntityMention\x12\x36\n\tsentiment\x18\x06 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb9\x01\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06PERSON\x10\x01\x12\x0c\n\x08LOCATION\x10\x02\x12\x10\n\x0cORGANIZATION\x10\x03\x12\t\n\x05\x45VENT\x10\x04\x12\x0f\n\x0bWORK_OF_ART\x10\x05\x12\x11\n\rCONSUMER_GOOD\x10\x06\x12\t\n\x05OTHER\x10\x07\x12\x10\n\x0cPHONE_NUMBER\x10\t\x12\x0b\n\x07\x41\x44\x44RESS\x10\n\x12\x08\n\x04\x44\x41TE\x10\x0b\x12\n\n\x06NUMBER\x10\x0c\x12\t\n\x05PRICE\x10\r\"-\n\tSentiment\x12\x11\n\tmagnitude\x18\x01 \x01(\x02\x12\r\n\x05score\x18\x02 \x01(\x02\"\xfc\x01\n\rEntityMention\x12\x30\n\x04text\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.TextSpan\x12:\n\x04type\x18\x02 \x01(\x0e\x32,.google.cloud.language.v2.EntityMention.Type\x12\x36\n\tsentiment\x18\x03 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x13\n\x0bprobability\x18\x04 \x01(\x02\"0\n\x04Type\x12\x10\n\x0cTYPE_UNKNOWN\x10\x00\x12\n\n\x06PROPER\x10\x01\x12\n\n\x06\x43OMMON\x10\x02\"1\n\x08TextSpan\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x14\n\x0c\x62\x65gin_offset\x18\x02 \x01(\x05\"Q\n\x16\x43lassificationCategory\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x15\n\x08severity\x18\x03 \x01(\x02\x42\x03\xe0\x41\x01\"\x93\x01\n\x17\x41nalyzeSentimentRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x02 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\"\xc5\x01\n\x18\x41nalyzeSentimentResponse\x12?\n\x12\x64ocument_sentiment\x18\x01 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x35\n\tsentences\x18\x03 \x03(\x0b\x32\".google.cloud.language.v2.Sentence\x12\x1a\n\x12language_supported\x18\x04 \x01(\x08\"\x92\x01\n\x16\x41nalyzeEntitiesRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x02 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\"\x80\x01\n\x17\x41nalyzeEntitiesResponse\x12\x32\n\x08\x65ntities\x18\x01 \x03(\x0b\x32 .google.cloud.language.v2.Entity\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"P\n\x13\x43lassifyTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\"\x8f\x01\n\x14\x43lassifyTextResponse\x12\x44\n\ncategories\x18\x01 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"\x81\x02\n\x13ModerateTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12V\n\rmodel_version\x18\x02 \x01(\x0e\x32:.google.cloud.language.v2.ModerateTextRequest.ModelVersionB\x03\xe0\x41\x01\"W\n\x0cModelVersion\x12\x1d\n\x19MODEL_VERSION_UNSPECIFIED\x10\x00\x12\x13\n\x0fMODEL_VERSION_1\x10\x01\x12\x13\n\x0fMODEL_VERSION_2\x10\x02\"\x9a\x01\n\x14ModerateTextResponse\x12O\n\x15moderation_categories\x18\x01 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x15\n\rlanguage_code\x18\x02 \x01(\t\x12\x1a\n\x12language_supported\x18\x03 \x01(\x08\"\xeb\x02\n\x13\x41nnotateTextRequest\x12\x39\n\x08\x64ocument\x18\x01 \x01(\x0b\x32\".google.cloud.language.v2.DocumentB\x03\xe0\x41\x02\x12M\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x36.google.cloud.language.v2.AnnotateTextRequest.FeaturesB\x03\xe0\x41\x02\x12=\n\rencoding_type\x18\x03 \x01(\x0e\x32&.google.cloud.language.v2.EncodingType\x1a\x8a\x01\n\x08\x46\x65\x61tures\x12\x1d\n\x10\x65xtract_entities\x18\x01 \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65xtract_document_sentiment\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rclassify_text\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1a\n\rmoderate_text\x18\x05 \x01(\x08\x42\x03\xe0\x41\x01\"\x8c\x03\n\x14\x41nnotateTextResponse\x12\x35\n\tsentences\x18\x01 \x03(\x0b\x32\".google.cloud.language.v2.Sentence\x12\x32\n\x08\x65ntities\x18\x02 \x03(\x0b\x32 .google.cloud.language.v2.Entity\x12?\n\x12\x64ocument_sentiment\x18\x03 \x01(\x0b\x32#.google.cloud.language.v2.Sentiment\x12\x15\n\rlanguage_code\x18\x04 \x01(\t\x12\x44\n\ncategories\x18\x05 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12O\n\x15moderation_categories\x18\x06 \x03(\x0b\x32\x30.google.cloud.language.v2.ClassificationCategory\x12\x1a\n\x12language_supported\x18\x07 \x01(\x08*8\n\x0c\x45ncodingType\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04UTF8\x10\x01\x12\t\n\x05UTF16\x10\x02\x12\t\n\x05UTF32\x10\x03\x32\xb0\x08\n\x0fLanguageService\x12\xc8\x01\n\x10\x41nalyzeSentiment\x12\x31.google.cloud.language.v2.AnalyzeSentimentRequest\x1a\x32.google.cloud.language.v2.AnalyzeSentimentResponse\"M\xda\x41\x16\x64ocument,encoding_type\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02#\"\x1e/v2/documents:analyzeSentiment:\x01*\x12\xc4\x01\n\x0f\x41nalyzeEntities\x12\x30.google.cloud.language.v2.AnalyzeEntitiesRequest\x1a\x31.google.cloud.language.v2.AnalyzeEntitiesResponse\"L\xda\x41\x16\x64ocument,encoding_type\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02\"\"\x1d/v2/documents:analyzeEntities:\x01*\x12\x9f\x01\n\x0c\x43lassifyText\x12-.google.cloud.language.v2.ClassifyTextRequest\x1a..google.cloud.language.v2.ClassifyTextResponse\"0\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:classifyText:\x01*\x12\x9f\x01\n\x0cModerateText\x12-.google.cloud.language.v2.ModerateTextRequest\x1a..google.cloud.language.v2.ModerateTextResponse\"0\xda\x41\x08\x64ocument\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:moderateText:\x01*\x12\xca\x01\n\x0c\x41nnotateText\x12-.google.cloud.language.v2.AnnotateTextRequest\x1a..google.cloud.language.v2.AnnotateTextResponse\"[\xda\x41\x1f\x64ocument,features,encoding_type\xda\x41\x11\x64ocument,features\x82\xd3\xe4\x93\x02\x1f\"\x1a/v2/documents:annotateText:\x01*\x1az\xca\x41\x17language.googleapis.com\xd2\x41]https://www.googleapis.com/auth/cloud-language,https://www.googleapis.com/auth/cloud-platformBp\n\x1c\x63om.google.cloud.language.v2B\x14LanguageServiceProtoP\x01Z8cloud.google.com/go/language/apiv2/languagepb;languagepbb\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool @@ -56,6 +56,7 @@ module V2 ClassifyTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ClassifyTextRequest").msgclass ClassifyTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ClassifyTextResponse").msgclass ModerateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ModerateTextRequest").msgclass + ModerateTextRequest::ModelVersion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ModerateTextRequest.ModelVersion").enummodule ModerateTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.ModerateTextResponse").msgclass AnnotateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnnotateTextRequest").msgclass AnnotateTextRequest::Features = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.language.v2.AnnotateTextRequest.Features").msgclass diff --git a/google-cloud-language-v2/proto_docs/google/cloud/language/v2/language_service.rb b/google-cloud-language-v2/proto_docs/google/cloud/language/v2/language_service.rb index 295d1d7d78c6..4835c15b1432 100644 --- a/google-cloud-language-v2/proto_docs/google/cloud/language/v2/language_service.rb +++ b/google-cloud-language-v2/proto_docs/google/cloud/language/v2/language_service.rb @@ -90,8 +90,7 @@ class Sentence # @return [::Google::Protobuf::Map{::String => ::String}] # Metadata associated with the entity. # - # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) - # and Knowledge Graph MID (`mid`), if they are available. For the metadata + # For the metadata # associated with other entity types, see the Type table below. # @!attribute [rw] mentions # @return [::Array<::Google::Cloud::Language::V2::EntityMention>] @@ -116,8 +115,7 @@ class MetadataEntry extend ::Google::Protobuf::MessageExts::ClassMethods end - # The type of the entity. For most entity types, the associated metadata is a - # Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table + # The type of the entity. The table # below lists the associated fields for entities that have different # metadata. module Type @@ -167,7 +165,7 @@ module Type # * `locality` - city or town # * `street_name` - street/route name, if detected # * `postal_code` - postal code, if detected - # * `country` - country, if detected< + # * `country` - country, if detected # * `broad_region` - administrative area, such as the state, if detected # * `narrow_region` - smaller administrative area, such as county, if # detected @@ -272,6 +270,11 @@ class TextSpan # @return [::Float] # The classifier's confidence of the category. Number represents how certain # the classifier is that this category represents the given text. + # @!attribute [rw] severity + # @return [::Float] + # Optional. The classifier's severity of the category. This is only present + # when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and + # the corresponding category has a severity score. class ClassificationCategory include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -374,9 +377,28 @@ class ClassifyTextResponse # @!attribute [rw] document # @return [::Google::Cloud::Language::V2::Document] # Required. Input document. + # @!attribute [rw] model_version + # @return [::Google::Cloud::Language::V2::ModerateTextRequest::ModelVersion] + # Optional. The model version to use for ModerateText. class ModerateTextRequest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods + + # The model version to use for ModerateText. + module ModelVersion + # The default model version. + MODEL_VERSION_UNSPECIFIED = 0 + + # Use the v1 model, this model is used by default when not provided. + # The v1 model only returns probability (confidence) score for each + # category. + MODEL_VERSION_1 = 1 + + # Use the v2 model. + # The v2 model only returns probability (confidence) score for each + # category, and returns severity score for a subset of the categories. + MODEL_VERSION_2 = 2 + end end # The document moderation response message. diff --git a/google-cloud-language-v2/test/google/cloud/language/v2/language_service_rest_test.rb b/google-cloud-language-v2/test/google/cloud/language/v2/language_service_rest_test.rb index f8aa23eb984c..34bdf79b2df2 100644 --- a/google-cloud-language-v2/test/google/cloud/language/v2/language_service_rest_test.rb +++ b/google-cloud-language-v2/test/google/cloud/language/v2/language_service_rest_test.rb @@ -243,6 +243,7 @@ def test_moderate_text # Create request parameters for a unary method. document = {} + model_version = :MODEL_VERSION_UNSPECIFIED moderate_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| assert options.metadata.key? :"x-goog-api-client" @@ -258,27 +259,27 @@ def test_moderate_text end # Use hash object - client.moderate_text({ document: document }) do |_result, response| + client.moderate_text({ document: document, model_version: model_version }) do |_result, response| assert_equal http_response, response.underlying_op end # Use named arguments - client.moderate_text document: document do |_result, response| + client.moderate_text document: document, model_version: model_version do |_result, response| assert_equal http_response, response.underlying_op end # Use protobuf object - client.moderate_text ::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document) do |_result, response| + client.moderate_text ::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document, model_version: model_version) do |_result, response| assert_equal http_response, response.underlying_op end # Use hash object with options - client.moderate_text({ document: document }, call_options) do |_result, response| + client.moderate_text({ document: document, model_version: model_version }, call_options) do |_result, response| assert_equal http_response, response.underlying_op end # Use protobuf object with options - client.moderate_text(::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document), call_options) do |_result, response| + client.moderate_text(::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document, model_version: model_version), call_options) do |_result, response| assert_equal http_response, response.underlying_op end diff --git a/google-cloud-language-v2/test/google/cloud/language/v2/language_service_test.rb b/google-cloud-language-v2/test/google/cloud/language/v2/language_service_test.rb index f3737a78e837..463dfc3ef756 100644 --- a/google-cloud-language-v2/test/google/cloud/language/v2/language_service_test.rb +++ b/google-cloud-language-v2/test/google/cloud/language/v2/language_service_test.rb @@ -242,11 +242,13 @@ def test_moderate_text # Create request parameters for a unary method. document = {} + model_version = :MODEL_VERSION_UNSPECIFIED moderate_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :moderate_text, name assert_kind_of ::Google::Cloud::Language::V2::ModerateTextRequest, request assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Language::V2::Document), request["document"] + assert_equal :MODEL_VERSION_UNSPECIFIED, request["model_version"] refute_nil options end @@ -257,31 +259,31 @@ def test_moderate_text end # Use hash object - client.moderate_text({ document: document }) do |response, operation| + client.moderate_text({ document: document, model_version: model_version }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments - client.moderate_text document: document do |response, operation| + client.moderate_text document: document, model_version: model_version do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object - client.moderate_text ::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document) do |response, operation| + client.moderate_text ::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document, model_version: model_version) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options - client.moderate_text({ document: document }, grpc_options) do |response, operation| + client.moderate_text({ document: document, model_version: model_version }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options - client.moderate_text(::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document), grpc_options) do |response, operation| + client.moderate_text(::Google::Cloud::Language::V2::ModerateTextRequest.new(document: document, model_version: model_version), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end