aws-sdk-comprehend 1.74.0 → 1.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-comprehend/client.rb +95 -21
- data/lib/aws-sdk-comprehend/client_api.rb +45 -0
- data/lib/aws-sdk-comprehend/endpoint_provider.rb +1 -1
- data/lib/aws-sdk-comprehend/endpoints.rb +14 -0
- data/lib/aws-sdk-comprehend/plugins/endpoints.rb +2 -0
- data/lib/aws-sdk-comprehend/types.rb +149 -30
- data/lib/aws-sdk-comprehend.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9e8bee756fc3152e45e7e9eba6f638c438d5c446937f5f7df58417e9aff7747
|
4
|
+
data.tar.gz: 2b3b8dc2ab010caa5157c961df42be58055f2dc608b90c5143497e78640dc307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef15546ae0dee5f6edc287e53cbe85e0c9ea698a0b54de552178955a87084be7b4a827e07fbb7b50aebcb1b79cc6f22874df9caed655fa331da7b928c430094c
|
7
|
+
data.tar.gz: c41643bfda0628db67b8e3475f4647a1321d68d58ed858dfeb697bf34e4ee1c8a88fc0e9106e997639f812aab80c07c77bdeb6a5a1ed7eabaf6210ad00eb07ed
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
1.76.0 (2023-11-22)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
|
8
|
+
|
9
|
+
1.75.0 (2023-11-09)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - This release adds support for toxicity detection and prompt safety classification.
|
13
|
+
|
4
14
|
1.74.0 (2023-09-27)
|
5
15
|
------------------
|
6
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.76.0
|
@@ -663,7 +663,7 @@ module Aws::Comprehend
|
|
663
663
|
# each entity identified in the documents.
|
664
664
|
#
|
665
665
|
# For more information about targeted sentiment, see [Targeted
|
666
|
-
# sentiment][1]
|
666
|
+
# sentiment][1] in the *Amazon Comprehend Developer Guide*.
|
667
667
|
#
|
668
668
|
#
|
669
669
|
#
|
@@ -723,12 +723,20 @@ module Aws::Comprehend
|
|
723
723
|
req.send_request(options)
|
724
724
|
end
|
725
725
|
|
726
|
-
# Creates a
|
727
|
-
#
|
728
|
-
# model and an endpoint.
|
726
|
+
# Creates a classification request to analyze a single document in
|
727
|
+
# real-time. `ClassifyDocument` supports the following model types:
|
729
728
|
#
|
730
|
-
#
|
731
|
-
#
|
729
|
+
# * Custom classifier - a custom model that you have created and
|
730
|
+
# trained. For input, you can provide plain text, a single-page
|
731
|
+
# document (PDF, Word, or image), or Textract API output. For more
|
732
|
+
# information, see [Custom classification][1] in the *Amazon
|
733
|
+
# Comprehend Developer Guide*.
|
734
|
+
#
|
735
|
+
# * Prompt classifier - Amazon Comprehend provides a model for
|
736
|
+
# classifying prompts. For input, you provide English plain text
|
737
|
+
# input. For prompt classification, the response includes only the
|
738
|
+
# `Classes` field. For more information about prompt classifiers, see
|
739
|
+
# [Prompt classifiers][2] in the *Amazon Comprehend Developer Guide*.
|
732
740
|
#
|
733
741
|
# If the system detects errors while processing a page in the input
|
734
742
|
# document, the API response includes an entry in `Errors` that
|
@@ -737,28 +745,41 @@ module Aws::Comprehend
|
|
737
745
|
# If the system detects a document-level error in your input document,
|
738
746
|
# the API returns an `InvalidRequestException` error response. For
|
739
747
|
# details about this exception, see [ Errors in semi-structured
|
740
|
-
# documents][
|
748
|
+
# documents][3] in the Comprehend Developer Guide.
|
741
749
|
#
|
742
750
|
#
|
743
751
|
#
|
744
|
-
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/
|
752
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/how-document-classification.html
|
753
|
+
# [2]: https://docs.aws.amazon.com/comprehend/latest/dg/prompt-classification.html
|
754
|
+
# [3]: https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync-err.html
|
745
755
|
#
|
746
756
|
# @option params [String] :text
|
747
757
|
# The document text to be analyzed. If you enter text using this
|
748
758
|
# parameter, do not use the `Bytes` parameter.
|
749
759
|
#
|
750
760
|
# @option params [required, String] :endpoint_arn
|
751
|
-
# The Amazon Resource Number (ARN) of the endpoint.
|
752
|
-
# about endpoints, see [Managing endpoints][1].
|
761
|
+
# The Amazon Resource Number (ARN) of the endpoint.
|
753
762
|
#
|
763
|
+
# For prompt classification, Amazon Comprehend provides the endpoint
|
764
|
+
# ARN: `zzz`.
|
765
|
+
#
|
766
|
+
# For custom classification, you create an endpoint for your custom
|
767
|
+
# model. For more information, see [Using Amazon Comprehend
|
768
|
+
# endpoints][1].
|
754
769
|
#
|
755
770
|
#
|
756
|
-
#
|
771
|
+
#
|
772
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html
|
757
773
|
#
|
758
774
|
# @option params [String, StringIO, File] :bytes
|
759
775
|
# Use the `Bytes` parameter to input a text, PDF, Word or image file.
|
760
|
-
#
|
761
|
-
#
|
776
|
+
#
|
777
|
+
# When you classify a document using a custom model, you can also use
|
778
|
+
# the `Bytes` parameter to input an Amazon Textract `DetectDocumentText`
|
779
|
+
# or `AnalyzeDocument` output file.
|
780
|
+
#
|
781
|
+
# To classify a document using the prompt classifier, use the `Text`
|
782
|
+
# parameter for input.
|
762
783
|
#
|
763
784
|
# Provide the input document as a sequence of base64-encoded bytes. If
|
764
785
|
# your code uses an Amazon Web Services SDK to classify documents, the
|
@@ -1006,7 +1027,7 @@ module Aws::Comprehend
|
|
1006
1027
|
# @option params [Types::DocumentClassifierOutputDataConfig] :output_data_config
|
1007
1028
|
# Specifies the location for the output files from a custom classifier
|
1008
1029
|
# job. This parameter is required for a request that creates a native
|
1009
|
-
#
|
1030
|
+
# document model.
|
1010
1031
|
#
|
1011
1032
|
# @option params [String] :client_request_token
|
1012
1033
|
# A unique identifier for the request. If you don't set the client
|
@@ -1420,7 +1441,8 @@ module Aws::Comprehend
|
|
1420
1441
|
#
|
1421
1442
|
# @option params [String] :active_model_arn
|
1422
1443
|
# To associate an existing model with the flywheel, specify the Amazon
|
1423
|
-
# Resource Number (ARN) of the model version.
|
1444
|
+
# Resource Number (ARN) of the model version. Do not set `TaskConfig` or
|
1445
|
+
# `ModelType` if you specify an `ActiveModelArn`.
|
1424
1446
|
#
|
1425
1447
|
# @option params [required, String] :data_access_role_arn
|
1426
1448
|
# The Amazon Resource Name (ARN) of the IAM role that grants Amazon
|
@@ -1428,11 +1450,12 @@ module Aws::Comprehend
|
|
1428
1450
|
# data lake.
|
1429
1451
|
#
|
1430
1452
|
# @option params [Types::TaskConfig] :task_config
|
1431
|
-
# Configuration about the
|
1432
|
-
# flywheel.
|
1453
|
+
# Configuration about the model associated with the flywheel. You need
|
1454
|
+
# to set `TaskConfig` if you are creating a flywheel for a new model.
|
1433
1455
|
#
|
1434
1456
|
# @option params [String] :model_type
|
1435
|
-
# The model type.
|
1457
|
+
# The model type. You need to set `ModelType` if you are creating a
|
1458
|
+
# flywheel for a new model.
|
1436
1459
|
#
|
1437
1460
|
# @option params [required, String] :data_lake_s3_uri
|
1438
1461
|
# Enter the S3 location for the data lake. You can specify a new S3
|
@@ -2875,7 +2898,7 @@ module Aws::Comprehend
|
|
2875
2898
|
# entity identified in the text.
|
2876
2899
|
#
|
2877
2900
|
# For more information about targeted sentiment, see [Targeted
|
2878
|
-
# sentiment][1]
|
2901
|
+
# sentiment][1] in the *Amazon Comprehend Developer Guide*.
|
2879
2902
|
#
|
2880
2903
|
#
|
2881
2904
|
#
|
@@ -2926,6 +2949,57 @@ module Aws::Comprehend
|
|
2926
2949
|
req.send_request(options)
|
2927
2950
|
end
|
2928
2951
|
|
2952
|
+
# Performs toxicity analysis on the list of text strings that you
|
2953
|
+
# provide as input. The analysis uses the order of strings in the list
|
2954
|
+
# to determine context when predicting toxicity. The API response
|
2955
|
+
# contains a results list that matches the size of the input list. For
|
2956
|
+
# more information about toxicity detection, see [Toxicity detection][1]
|
2957
|
+
# in the *Amazon Comprehend Developer Guide*
|
2958
|
+
#
|
2959
|
+
#
|
2960
|
+
#
|
2961
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/toxicity-detection.html
|
2962
|
+
#
|
2963
|
+
# @option params [required, Array<Types::TextSegment>] :text_segments
|
2964
|
+
# A list of up to 10 text strings. The maximum size for the list is 10
|
2965
|
+
# KB.
|
2966
|
+
#
|
2967
|
+
# @option params [required, String] :language_code
|
2968
|
+
# The language of the input text. Currently, English is the only
|
2969
|
+
# supported language.
|
2970
|
+
#
|
2971
|
+
# @return [Types::DetectToxicContentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
2972
|
+
#
|
2973
|
+
# * {Types::DetectToxicContentResponse#result_list #result_list} => Array<Types::ToxicLabels>
|
2974
|
+
#
|
2975
|
+
# @example Request syntax with placeholder values
|
2976
|
+
#
|
2977
|
+
# resp = client.detect_toxic_content({
|
2978
|
+
# text_segments: [ # required
|
2979
|
+
# {
|
2980
|
+
# text: "CustomerInputString", # required
|
2981
|
+
# },
|
2982
|
+
# ],
|
2983
|
+
# language_code: "en", # required, accepts en, es, fr, de, it, pt, ar, hi, ja, ko, zh, zh-TW
|
2984
|
+
# })
|
2985
|
+
#
|
2986
|
+
# @example Response structure
|
2987
|
+
#
|
2988
|
+
# resp.result_list #=> Array
|
2989
|
+
# resp.result_list[0].labels #=> Array
|
2990
|
+
# resp.result_list[0].labels[0].name #=> String, one of "GRAPHIC", "HARASSMENT_OR_ABUSE", "HATE_SPEECH", "INSULT", "PROFANITY", "SEXUAL", "VIOLENCE_OR_THREAT"
|
2991
|
+
# resp.result_list[0].labels[0].score #=> Float
|
2992
|
+
# resp.result_list[0].toxicity #=> Float
|
2993
|
+
#
|
2994
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/DetectToxicContent AWS API Documentation
|
2995
|
+
#
|
2996
|
+
# @overload detect_toxic_content(params = {})
|
2997
|
+
# @param [Hash] params ({})
|
2998
|
+
def detect_toxic_content(params = {}, options = {})
|
2999
|
+
req = build_request(:detect_toxic_content, params)
|
3000
|
+
req.send_request(options)
|
3001
|
+
end
|
3002
|
+
|
2929
3003
|
# Creates a new custom model that replicates a source custom model that
|
2930
3004
|
# you import. The source model can be in your Amazon Web Services
|
2931
3005
|
# account or another one.
|
@@ -5092,7 +5166,7 @@ module Aws::Comprehend
|
|
5092
5166
|
#
|
5093
5167
|
#
|
5094
5168
|
#
|
5095
|
-
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/
|
5169
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/security_iam_id-based-policy-examples.html#auth-role-permissions
|
5096
5170
|
#
|
5097
5171
|
# @option params [String] :job_name
|
5098
5172
|
# The identifier of the job.
|
@@ -5835,7 +5909,7 @@ module Aws::Comprehend
|
|
5835
5909
|
params: params,
|
5836
5910
|
config: config)
|
5837
5911
|
context[:gem_name] = 'aws-sdk-comprehend'
|
5838
|
-
context[:gem_version] = '1.
|
5912
|
+
context[:gem_version] = '1.76.0'
|
5839
5913
|
Seahorse::Client::Request.new(handlers, context)
|
5840
5914
|
end
|
5841
5915
|
|
@@ -143,6 +143,8 @@ module Aws::Comprehend
|
|
143
143
|
DetectSyntaxResponse = Shapes::StructureShape.new(name: 'DetectSyntaxResponse')
|
144
144
|
DetectTargetedSentimentRequest = Shapes::StructureShape.new(name: 'DetectTargetedSentimentRequest')
|
145
145
|
DetectTargetedSentimentResponse = Shapes::StructureShape.new(name: 'DetectTargetedSentimentResponse')
|
146
|
+
DetectToxicContentRequest = Shapes::StructureShape.new(name: 'DetectToxicContentRequest')
|
147
|
+
DetectToxicContentResponse = Shapes::StructureShape.new(name: 'DetectToxicContentResponse')
|
146
148
|
DocumentClass = Shapes::StructureShape.new(name: 'DocumentClass')
|
147
149
|
DocumentClassificationConfig = Shapes::StructureShape.new(name: 'DocumentClassificationConfig')
|
148
150
|
DocumentClassificationJobFilter = Shapes::StructureShape.new(name: 'DocumentClassificationJobFilter')
|
@@ -307,6 +309,9 @@ module Aws::Comprehend
|
|
307
309
|
ListOfRelationships = Shapes::ListShape.new(name: 'ListOfRelationships')
|
308
310
|
ListOfSyntaxTokens = Shapes::ListShape.new(name: 'ListOfSyntaxTokens')
|
309
311
|
ListOfTargetedSentimentEntities = Shapes::ListShape.new(name: 'ListOfTargetedSentimentEntities')
|
312
|
+
ListOfTextSegments = Shapes::ListShape.new(name: 'ListOfTextSegments')
|
313
|
+
ListOfToxicContent = Shapes::ListShape.new(name: 'ListOfToxicContent')
|
314
|
+
ListOfToxicLabels = Shapes::ListShape.new(name: 'ListOfToxicLabels')
|
310
315
|
ListOfWarnings = Shapes::ListShape.new(name: 'ListOfWarnings')
|
311
316
|
ListPiiEntitiesDetectionJobsRequest = Shapes::StructureShape.new(name: 'ListPiiEntitiesDetectionJobsRequest')
|
312
317
|
ListPiiEntitiesDetectionJobsResponse = Shapes::StructureShape.new(name: 'ListPiiEntitiesDetectionJobsResponse')
|
@@ -420,6 +425,7 @@ module Aws::Comprehend
|
|
420
425
|
TargetedSentimentEntityType = Shapes::StringShape.new(name: 'TargetedSentimentEntityType')
|
421
426
|
TargetedSentimentMention = Shapes::StructureShape.new(name: 'TargetedSentimentMention')
|
422
427
|
TaskConfig = Shapes::StructureShape.new(name: 'TaskConfig')
|
428
|
+
TextSegment = Shapes::StructureShape.new(name: 'TextSegment')
|
423
429
|
TextSizeLimitExceededException = Shapes::StructureShape.new(name: 'TextSizeLimitExceededException')
|
424
430
|
Timestamp = Shapes::TimestampShape.new(name: 'Timestamp')
|
425
431
|
TooManyRequestsException = Shapes::StructureShape.new(name: 'TooManyRequestsException')
|
@@ -428,6 +434,9 @@ module Aws::Comprehend
|
|
428
434
|
TopicsDetectionJobFilter = Shapes::StructureShape.new(name: 'TopicsDetectionJobFilter')
|
429
435
|
TopicsDetectionJobProperties = Shapes::StructureShape.new(name: 'TopicsDetectionJobProperties')
|
430
436
|
TopicsDetectionJobPropertiesList = Shapes::ListShape.new(name: 'TopicsDetectionJobPropertiesList')
|
437
|
+
ToxicContent = Shapes::StructureShape.new(name: 'ToxicContent')
|
438
|
+
ToxicContentType = Shapes::StringShape.new(name: 'ToxicContentType')
|
439
|
+
ToxicLabels = Shapes::StructureShape.new(name: 'ToxicLabels')
|
431
440
|
UnsupportedLanguageException = Shapes::StructureShape.new(name: 'UnsupportedLanguageException')
|
432
441
|
UntagResourceRequest = Shapes::StructureShape.new(name: 'UntagResourceRequest')
|
433
442
|
UntagResourceResponse = Shapes::StructureShape.new(name: 'UntagResourceResponse')
|
@@ -915,6 +924,13 @@ module Aws::Comprehend
|
|
915
924
|
DetectTargetedSentimentResponse.add_member(:entities, Shapes::ShapeRef.new(shape: ListOfTargetedSentimentEntities, location_name: "Entities"))
|
916
925
|
DetectTargetedSentimentResponse.struct_class = Types::DetectTargetedSentimentResponse
|
917
926
|
|
927
|
+
DetectToxicContentRequest.add_member(:text_segments, Shapes::ShapeRef.new(shape: ListOfTextSegments, required: true, location_name: "TextSegments"))
|
928
|
+
DetectToxicContentRequest.add_member(:language_code, Shapes::ShapeRef.new(shape: LanguageCode, required: true, location_name: "LanguageCode"))
|
929
|
+
DetectToxicContentRequest.struct_class = Types::DetectToxicContentRequest
|
930
|
+
|
931
|
+
DetectToxicContentResponse.add_member(:result_list, Shapes::ShapeRef.new(shape: ListOfToxicLabels, location_name: "ResultList"))
|
932
|
+
DetectToxicContentResponse.struct_class = Types::DetectToxicContentResponse
|
933
|
+
|
918
934
|
DocumentClass.add_member(:name, Shapes::ShapeRef.new(shape: String, location_name: "Name"))
|
919
935
|
DocumentClass.add_member(:score, Shapes::ShapeRef.new(shape: Float, location_name: "Score"))
|
920
936
|
DocumentClass.add_member(:page, Shapes::ShapeRef.new(shape: Integer, location_name: "Page"))
|
@@ -1531,6 +1547,12 @@ module Aws::Comprehend
|
|
1531
1547
|
|
1532
1548
|
ListOfTargetedSentimentEntities.member = Shapes::ShapeRef.new(shape: TargetedSentimentEntity)
|
1533
1549
|
|
1550
|
+
ListOfTextSegments.member = Shapes::ShapeRef.new(shape: TextSegment)
|
1551
|
+
|
1552
|
+
ListOfToxicContent.member = Shapes::ShapeRef.new(shape: ToxicContent)
|
1553
|
+
|
1554
|
+
ListOfToxicLabels.member = Shapes::ShapeRef.new(shape: ToxicLabels)
|
1555
|
+
|
1534
1556
|
ListOfWarnings.member = Shapes::ShapeRef.new(shape: WarningsListItem)
|
1535
1557
|
|
1536
1558
|
ListPiiEntitiesDetectionJobsRequest.add_member(:filter, Shapes::ShapeRef.new(shape: PiiEntitiesDetectionJobFilter, location_name: "Filter"))
|
@@ -1969,6 +1991,9 @@ module Aws::Comprehend
|
|
1969
1991
|
TaskConfig.add_member(:entity_recognition_config, Shapes::ShapeRef.new(shape: EntityRecognitionConfig, location_name: "EntityRecognitionConfig"))
|
1970
1992
|
TaskConfig.struct_class = Types::TaskConfig
|
1971
1993
|
|
1994
|
+
TextSegment.add_member(:text, Shapes::ShapeRef.new(shape: CustomerInputString, required: true, location_name: "Text"))
|
1995
|
+
TextSegment.struct_class = Types::TextSegment
|
1996
|
+
|
1972
1997
|
TextSizeLimitExceededException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "Message"))
|
1973
1998
|
TextSizeLimitExceededException.struct_class = Types::TextSizeLimitExceededException
|
1974
1999
|
|
@@ -2004,6 +2029,14 @@ module Aws::Comprehend
|
|
2004
2029
|
|
2005
2030
|
TopicsDetectionJobPropertiesList.member = Shapes::ShapeRef.new(shape: TopicsDetectionJobProperties)
|
2006
2031
|
|
2032
|
+
ToxicContent.add_member(:name, Shapes::ShapeRef.new(shape: ToxicContentType, location_name: "Name"))
|
2033
|
+
ToxicContent.add_member(:score, Shapes::ShapeRef.new(shape: Float, location_name: "Score"))
|
2034
|
+
ToxicContent.struct_class = Types::ToxicContent
|
2035
|
+
|
2036
|
+
ToxicLabels.add_member(:labels, Shapes::ShapeRef.new(shape: ListOfToxicContent, location_name: "Labels"))
|
2037
|
+
ToxicLabels.add_member(:toxicity, Shapes::ShapeRef.new(shape: Float, location_name: "Toxicity"))
|
2038
|
+
ToxicLabels.struct_class = Types::ToxicLabels
|
2039
|
+
|
2007
2040
|
UnsupportedLanguageException.add_member(:message, Shapes::ShapeRef.new(shape: String, location_name: "Message"))
|
2008
2041
|
UnsupportedLanguageException.struct_class = Types::UnsupportedLanguageException
|
2009
2042
|
|
@@ -2588,6 +2621,18 @@ module Aws::Comprehend
|
|
2588
2621
|
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
2589
2622
|
end)
|
2590
2623
|
|
2624
|
+
api.add_operation(:detect_toxic_content, Seahorse::Model::Operation.new.tap do |o|
|
2625
|
+
o.name = "DetectToxicContent"
|
2626
|
+
o.http_method = "POST"
|
2627
|
+
o.http_request_uri = "/"
|
2628
|
+
o.input = Shapes::ShapeRef.new(shape: DetectToxicContentRequest)
|
2629
|
+
o.output = Shapes::ShapeRef.new(shape: DetectToxicContentResponse)
|
2630
|
+
o.errors << Shapes::ShapeRef.new(shape: InvalidRequestException)
|
2631
|
+
o.errors << Shapes::ShapeRef.new(shape: TextSizeLimitExceededException)
|
2632
|
+
o.errors << Shapes::ShapeRef.new(shape: UnsupportedLanguageException)
|
2633
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
2634
|
+
end)
|
2635
|
+
|
2591
2636
|
api.add_operation(:import_model, Seahorse::Model::Operation.new.tap do |o|
|
2592
2637
|
o.name = "ImportModel"
|
2593
2638
|
o.http_method = "POST"
|
@@ -32,7 +32,7 @@ module Aws::Comprehend
|
|
32
32
|
raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
|
33
33
|
end
|
34
34
|
if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
|
35
|
-
if Aws::Endpoints::Matchers.boolean_equals?(
|
35
|
+
if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
|
36
36
|
return Aws::Endpoints::Endpoint.new(url: "https://comprehend-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
|
37
37
|
end
|
38
38
|
raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
|
@@ -586,6 +586,20 @@ module Aws::Comprehend
|
|
586
586
|
end
|
587
587
|
end
|
588
588
|
|
589
|
+
class DetectToxicContent
|
590
|
+
def self.build(context)
|
591
|
+
unless context.config.regional_endpoint
|
592
|
+
endpoint = context.config.endpoint.to_s
|
593
|
+
end
|
594
|
+
Aws::Comprehend::EndpointParameters.new(
|
595
|
+
region: context.config.region,
|
596
|
+
use_dual_stack: context.config.use_dualstack_endpoint,
|
597
|
+
use_fips: context.config.use_fips_endpoint,
|
598
|
+
endpoint: endpoint,
|
599
|
+
)
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
589
603
|
class ImportModel
|
590
604
|
def self.build(context)
|
591
605
|
unless context.config.regional_endpoint
|
@@ -138,6 +138,8 @@ module Aws::Comprehend
|
|
138
138
|
Aws::Comprehend::Endpoints::DetectSyntax.build(context)
|
139
139
|
when :detect_targeted_sentiment
|
140
140
|
Aws::Comprehend::Endpoints::DetectTargetedSentiment.build(context)
|
141
|
+
when :detect_toxic_content
|
142
|
+
Aws::Comprehend::Endpoints::DetectToxicContent.build(context)
|
141
143
|
when :import_model
|
142
144
|
Aws::Comprehend::Endpoints::ImportModel.build(context)
|
143
145
|
when :list_datasets
|
@@ -778,19 +778,30 @@ module Aws::Comprehend
|
|
778
778
|
# @return [String]
|
779
779
|
#
|
780
780
|
# @!attribute [rw] endpoint_arn
|
781
|
-
# The Amazon Resource Number (ARN) of the endpoint.
|
782
|
-
# about endpoints, see [Managing endpoints][1].
|
781
|
+
# The Amazon Resource Number (ARN) of the endpoint.
|
783
782
|
#
|
783
|
+
# For prompt classification, Amazon Comprehend provides the endpoint
|
784
|
+
# ARN: `zzz`.
|
784
785
|
#
|
786
|
+
# For custom classification, you create an endpoint for your custom
|
787
|
+
# model. For more information, see [Using Amazon Comprehend
|
788
|
+
# endpoints][1].
|
785
789
|
#
|
786
|
-
#
|
790
|
+
#
|
791
|
+
#
|
792
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html
|
787
793
|
# @return [String]
|
788
794
|
#
|
789
795
|
# @!attribute [rw] bytes
|
790
796
|
# Use the `Bytes` parameter to input a text, PDF, Word or image file.
|
791
|
-
#
|
797
|
+
#
|
798
|
+
# When you classify a document using a custom model, you can also use
|
799
|
+
# the `Bytes` parameter to input an Amazon Textract
|
792
800
|
# `DetectDocumentText` or `AnalyzeDocument` output file.
|
793
801
|
#
|
802
|
+
# To classify a document using the prompt classifier, use the `Text`
|
803
|
+
# parameter for input.
|
804
|
+
#
|
794
805
|
# Provide the input document as a sequence of base64-encoded bytes. If
|
795
806
|
# your code uses an Amazon Web Services SDK to classify documents, the
|
796
807
|
# SDK may encode the document file bytes for you.
|
@@ -828,6 +839,11 @@ module Aws::Comprehend
|
|
828
839
|
# exclusive and each document is expected to have only a single class
|
829
840
|
# assigned to it. For example, an animal can be a dog or a cat, but
|
830
841
|
# not both at the same time.
|
842
|
+
#
|
843
|
+
# For prompt classification, the response includes a single class
|
844
|
+
# (`UNDESIRED_PROMPT`), along with a confidence score. A higher
|
845
|
+
# confidence score indicates that the input prompt is undesired in
|
846
|
+
# nature.
|
831
847
|
# @return [Array<Types::DocumentClass>]
|
832
848
|
#
|
833
849
|
# @!attribute [rw] labels
|
@@ -1017,7 +1033,7 @@ module Aws::Comprehend
|
|
1017
1033
|
# @!attribute [rw] output_data_config
|
1018
1034
|
# Specifies the location for the output files from a custom classifier
|
1019
1035
|
# job. This parameter is required for a request that creates a native
|
1020
|
-
#
|
1036
|
+
# document model.
|
1021
1037
|
# @return [Types::DocumentClassifierOutputDataConfig]
|
1022
1038
|
#
|
1023
1039
|
# @!attribute [rw] client_request_token
|
@@ -1342,7 +1358,8 @@ module Aws::Comprehend
|
|
1342
1358
|
#
|
1343
1359
|
# @!attribute [rw] active_model_arn
|
1344
1360
|
# To associate an existing model with the flywheel, specify the Amazon
|
1345
|
-
# Resource Number (ARN) of the model version.
|
1361
|
+
# Resource Number (ARN) of the model version. Do not set `TaskConfig`
|
1362
|
+
# or `ModelType` if you specify an `ActiveModelArn`.
|
1346
1363
|
# @return [String]
|
1347
1364
|
#
|
1348
1365
|
# @!attribute [rw] data_access_role_arn
|
@@ -1352,12 +1369,13 @@ module Aws::Comprehend
|
|
1352
1369
|
# @return [String]
|
1353
1370
|
#
|
1354
1371
|
# @!attribute [rw] task_config
|
1355
|
-
# Configuration about the
|
1356
|
-
# flywheel.
|
1372
|
+
# Configuration about the model associated with the flywheel. You need
|
1373
|
+
# to set `TaskConfig` if you are creating a flywheel for a new model.
|
1357
1374
|
# @return [Types::TaskConfig]
|
1358
1375
|
#
|
1359
1376
|
# @!attribute [rw] model_type
|
1360
|
-
# The model type.
|
1377
|
+
# The model type. You need to set `ModelType` if you are creating a
|
1378
|
+
# flywheel for a new model.
|
1361
1379
|
# @return [String]
|
1362
1380
|
#
|
1363
1381
|
# @!attribute [rw] data_lake_s3_uri
|
@@ -2650,6 +2668,41 @@ module Aws::Comprehend
|
|
2650
2668
|
include Aws::Structure
|
2651
2669
|
end
|
2652
2670
|
|
2671
|
+
# @!attribute [rw] text_segments
|
2672
|
+
# A list of up to 10 text strings. The maximum size for the list is 10
|
2673
|
+
# KB.
|
2674
|
+
# @return [Array<Types::TextSegment>]
|
2675
|
+
#
|
2676
|
+
# @!attribute [rw] language_code
|
2677
|
+
# The language of the input text. Currently, English is the only
|
2678
|
+
# supported language.
|
2679
|
+
# @return [String]
|
2680
|
+
#
|
2681
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/DetectToxicContentRequest AWS API Documentation
|
2682
|
+
#
|
2683
|
+
class DetectToxicContentRequest < Struct.new(
|
2684
|
+
:text_segments,
|
2685
|
+
:language_code)
|
2686
|
+
SENSITIVE = [:text_segments]
|
2687
|
+
include Aws::Structure
|
2688
|
+
end
|
2689
|
+
|
2690
|
+
# @!attribute [rw] result_list
|
2691
|
+
# Results of the content moderation analysis. Each entry in the
|
2692
|
+
# results list contains a list of toxic content types identified in
|
2693
|
+
# the text, along with a confidence score for each content type. The
|
2694
|
+
# results list also includes a toxicity score for each entry in the
|
2695
|
+
# results list.
|
2696
|
+
# @return [Array<Types::ToxicLabels>]
|
2697
|
+
#
|
2698
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/DetectToxicContentResponse AWS API Documentation
|
2699
|
+
#
|
2700
|
+
class DetectToxicContentResponse < Struct.new(
|
2701
|
+
:result_list)
|
2702
|
+
SENSITIVE = []
|
2703
|
+
include Aws::Structure
|
2704
|
+
end
|
2705
|
+
|
2653
2706
|
# Specifies the class that categorizes the document being analyzed
|
2654
2707
|
#
|
2655
2708
|
# @!attribute [rw] name
|
@@ -2676,7 +2729,7 @@ module Aws::Comprehend
|
|
2676
2729
|
include Aws::Structure
|
2677
2730
|
end
|
2678
2731
|
|
2679
|
-
# Configuration required for a
|
2732
|
+
# Configuration required for a document classification model.
|
2680
2733
|
#
|
2681
2734
|
# @!attribute [rw] mode
|
2682
2735
|
# Classification mode indicates whether the documents are
|
@@ -2814,7 +2867,7 @@ module Aws::Comprehend
|
|
2814
2867
|
#
|
2815
2868
|
#
|
2816
2869
|
#
|
2817
|
-
# [1]: https://docs.aws.amazon.com/
|
2870
|
+
# [1]: https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html
|
2818
2871
|
# @return [Types::VpcConfig]
|
2819
2872
|
#
|
2820
2873
|
# @!attribute [rw] flywheel_arn
|
@@ -2843,7 +2896,7 @@ module Aws::Comprehend
|
|
2843
2896
|
end
|
2844
2897
|
|
2845
2898
|
# The location of the training documents. This parameter is required in
|
2846
|
-
# a request to create a
|
2899
|
+
# a request to create a semi-structured document classification model.
|
2847
2900
|
#
|
2848
2901
|
# @!attribute [rw] s3_uri
|
2849
2902
|
# The S3 URI location of the training documents specified in the S3Uri
|
@@ -2947,9 +3000,9 @@ module Aws::Comprehend
|
|
2947
3000
|
# @return [String]
|
2948
3001
|
#
|
2949
3002
|
# @!attribute [rw] test_s3_uri
|
2950
|
-
# This specifies the Amazon S3 location
|
2951
|
-
#
|
2952
|
-
# Web Services Region as the API endpoint that you are calling.
|
3003
|
+
# This specifies the Amazon S3 location that contains the test
|
3004
|
+
# annotations for the document classifier. The URI must be in the same
|
3005
|
+
# Amazon Web Services Region as the API endpoint that you are calling.
|
2953
3006
|
# @return [String]
|
2954
3007
|
#
|
2955
3008
|
# @!attribute [rw] label_delimiter
|
@@ -2974,12 +3027,12 @@ module Aws::Comprehend
|
|
2974
3027
|
# @!attribute [rw] document_type
|
2975
3028
|
# The type of input documents for training the model. Provide
|
2976
3029
|
# plain-text documents to create a plain-text model, and provide
|
2977
|
-
# semi-structured documents to create a native model.
|
3030
|
+
# semi-structured documents to create a native document model.
|
2978
3031
|
# @return [String]
|
2979
3032
|
#
|
2980
3033
|
# @!attribute [rw] documents
|
2981
3034
|
# The S3 location of the training documents. This parameter is
|
2982
|
-
# required in a request to create a native
|
3035
|
+
# required in a request to create a native document model.
|
2983
3036
|
# @return [Types::DocumentClassifierDocuments]
|
2984
3037
|
#
|
2985
3038
|
# @!attribute [rw] document_reader_config
|
@@ -3026,7 +3079,7 @@ module Aws::Comprehend
|
|
3026
3079
|
end
|
3027
3080
|
|
3028
3081
|
# Provide the location for output data from a custom classifier job.
|
3029
|
-
# This field is mandatory if you are training a native
|
3082
|
+
# This field is mandatory if you are training a native document model.
|
3030
3083
|
#
|
3031
3084
|
# @!attribute [rw] s3_uri
|
3032
3085
|
# When you use the `OutputDataConfig` object while creating a custom
|
@@ -3161,7 +3214,7 @@ module Aws::Comprehend
|
|
3161
3214
|
#
|
3162
3215
|
#
|
3163
3216
|
#
|
3164
|
-
# [1]: https://docs.aws.amazon.com/
|
3217
|
+
# [1]: https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html
|
3165
3218
|
# @return [Types::VpcConfig]
|
3166
3219
|
#
|
3167
3220
|
# @!attribute [rw] mode
|
@@ -4769,8 +4822,7 @@ module Aws::Comprehend
|
|
4769
4822
|
# @return [String]
|
4770
4823
|
#
|
4771
4824
|
# @!attribute [rw] task_config
|
4772
|
-
# Configuration about the
|
4773
|
-
# flywheel.
|
4825
|
+
# Configuration about the model associated with a flywheel.
|
4774
4826
|
# @return [Types::TaskConfig]
|
4775
4827
|
#
|
4776
4828
|
# @!attribute [rw] data_lake_s3_uri
|
@@ -6046,7 +6098,7 @@ module Aws::Comprehend
|
|
6046
6098
|
# entity.
|
6047
6099
|
#
|
6048
6100
|
# For more information about targeted sentiment, see [Targeted
|
6049
|
-
# sentiment][1]
|
6101
|
+
# sentiment][1] in the *Amazon Comprehend Developer Guide*.
|
6050
6102
|
#
|
6051
6103
|
#
|
6052
6104
|
#
|
@@ -6092,7 +6144,10 @@ module Aws::Comprehend
|
|
6092
6144
|
# @!attribute [rw] kms_key_id
|
6093
6145
|
# ID for the Amazon Web Services Key Management Service (KMS) key that
|
6094
6146
|
# Amazon Comprehend uses to encrypt the output results from an
|
6095
|
-
# analysis job.
|
6147
|
+
# analysis job. Specify the Key Id of a symmetric key, because you
|
6148
|
+
# cannot use an asymmetric key for uploading data to S3.
|
6149
|
+
#
|
6150
|
+
# The KmsKeyId can be one of the following formats:
|
6096
6151
|
#
|
6097
6152
|
# * KMS Key ID: `"1234abcd-12ab-34cd-56ef-1234567890ab"`
|
6098
6153
|
#
|
@@ -7565,7 +7620,7 @@ module Aws::Comprehend
|
|
7565
7620
|
#
|
7566
7621
|
#
|
7567
7622
|
#
|
7568
|
-
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/
|
7623
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/security_iam_id-based-policy-examples.html#auth-role-permissions
|
7569
7624
|
# @return [String]
|
7570
7625
|
#
|
7571
7626
|
# @!attribute [rw] job_name
|
@@ -8289,7 +8344,7 @@ module Aws::Comprehend
|
|
8289
8344
|
# analysis.
|
8290
8345
|
#
|
8291
8346
|
# For more information about targeted sentiment, see [Targeted
|
8292
|
-
# sentiment][1]
|
8347
|
+
# sentiment][1] in the *Amazon Comprehend Developer Guide*.
|
8293
8348
|
#
|
8294
8349
|
#
|
8295
8350
|
#
|
@@ -8324,7 +8379,7 @@ module Aws::Comprehend
|
|
8324
8379
|
# the mention.
|
8325
8380
|
#
|
8326
8381
|
# For more information about targeted sentiment, see [Targeted
|
8327
|
-
# sentiment][1]
|
8382
|
+
# sentiment][1] in the *Amazon Comprehend Developer Guide*.
|
8328
8383
|
#
|
8329
8384
|
#
|
8330
8385
|
#
|
@@ -8379,15 +8434,14 @@ module Aws::Comprehend
|
|
8379
8434
|
include Aws::Structure
|
8380
8435
|
end
|
8381
8436
|
|
8382
|
-
# Configuration about the
|
8383
|
-
# flywheel.
|
8437
|
+
# Configuration about the model associated with a flywheel.
|
8384
8438
|
#
|
8385
8439
|
# @!attribute [rw] language_code
|
8386
8440
|
# Language code for the language that the model supports.
|
8387
8441
|
# @return [String]
|
8388
8442
|
#
|
8389
8443
|
# @!attribute [rw] document_classification_config
|
8390
|
-
# Configuration required for a classification model.
|
8444
|
+
# Configuration required for a document classification model.
|
8391
8445
|
# @return [Types::DocumentClassificationConfig]
|
8392
8446
|
#
|
8393
8447
|
# @!attribute [rw] entity_recognition_config
|
@@ -8404,6 +8458,20 @@ module Aws::Comprehend
|
|
8404
8458
|
include Aws::Structure
|
8405
8459
|
end
|
8406
8460
|
|
8461
|
+
# One of the of text strings. Each string has a size limit of 1KB.
|
8462
|
+
#
|
8463
|
+
# @!attribute [rw] text
|
8464
|
+
# The text content.
|
8465
|
+
# @return [String]
|
8466
|
+
#
|
8467
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/TextSegment AWS API Documentation
|
8468
|
+
#
|
8469
|
+
class TextSegment < Struct.new(
|
8470
|
+
:text)
|
8471
|
+
SENSITIVE = [:text]
|
8472
|
+
include Aws::Structure
|
8473
|
+
end
|
8474
|
+
|
8407
8475
|
# The size of the input text exceeds the limit. Use a smaller document.
|
8408
8476
|
#
|
8409
8477
|
# @!attribute [rw] message
|
@@ -8598,6 +8666,57 @@ module Aws::Comprehend
|
|
8598
8666
|
include Aws::Structure
|
8599
8667
|
end
|
8600
8668
|
|
8669
|
+
# Toxic content analysis result for one string. For more information
|
8670
|
+
# about toxicity detection, see [Toxicity detection][1] in the *Amazon
|
8671
|
+
# Comprehend Developer Guide*
|
8672
|
+
#
|
8673
|
+
#
|
8674
|
+
#
|
8675
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/toxicity-detection.html
|
8676
|
+
#
|
8677
|
+
# @!attribute [rw] name
|
8678
|
+
# The name of the toxic content type.
|
8679
|
+
# @return [String]
|
8680
|
+
#
|
8681
|
+
# @!attribute [rw] score
|
8682
|
+
# Model confidence in the detected content type. Value range is zero
|
8683
|
+
# to one, where one is highest confidence.
|
8684
|
+
# @return [Float]
|
8685
|
+
#
|
8686
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/ToxicContent AWS API Documentation
|
8687
|
+
#
|
8688
|
+
class ToxicContent < Struct.new(
|
8689
|
+
:name,
|
8690
|
+
:score)
|
8691
|
+
SENSITIVE = []
|
8692
|
+
include Aws::Structure
|
8693
|
+
end
|
8694
|
+
|
8695
|
+
# Toxicity analysis result for one string. For more information about
|
8696
|
+
# toxicity detection, see [Toxicity detection][1] in the *Amazon
|
8697
|
+
# Comprehend Developer Guide*
|
8698
|
+
#
|
8699
|
+
#
|
8700
|
+
#
|
8701
|
+
# [1]: https://docs.aws.amazon.com/comprehend/latest/dg/toxicity-detection.html
|
8702
|
+
#
|
8703
|
+
# @!attribute [rw] labels
|
8704
|
+
# Array of toxic content types identified in the string.
|
8705
|
+
# @return [Array<Types::ToxicContent>]
|
8706
|
+
#
|
8707
|
+
# @!attribute [rw] toxicity
|
8708
|
+
# Overall toxicity score for the string.
|
8709
|
+
# @return [Float]
|
8710
|
+
#
|
8711
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/ToxicLabels AWS API Documentation
|
8712
|
+
#
|
8713
|
+
class ToxicLabels < Struct.new(
|
8714
|
+
:labels,
|
8715
|
+
:toxicity)
|
8716
|
+
SENSITIVE = []
|
8717
|
+
include Aws::Structure
|
8718
|
+
end
|
8719
|
+
|
8601
8720
|
# Amazon Comprehend can't process the language of the input text. For
|
8602
8721
|
# custom entity recognition APIs, only English, Spanish, French,
|
8603
8722
|
# Italian, German, or Portuguese are accepted. For a list of supported
|
@@ -8817,7 +8936,7 @@ module Aws::Comprehend
|
|
8817
8936
|
# the input document:
|
8818
8937
|
#
|
8819
8938
|
# * The document to classify is plain text, but the classifier is a
|
8820
|
-
# native model.
|
8939
|
+
# native document model.
|
8821
8940
|
#
|
8822
8941
|
# * The document to classify is semi-structured, but the classifier is a
|
8823
8942
|
# plain-text model.
|
data/lib/aws-sdk-comprehend.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-comprehend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.76.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.
|
22
|
+
version: 3.188.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.
|
32
|
+
version: 3.188.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: aws-sigv4
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '2.
|
83
|
+
version: '2.5'
|
84
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|