From 9e7552a0ec27e12e4e84b565924995e1c0bb1411 Mon Sep 17 00:00:00 2001 From: awstools Date: Thu, 20 Jul 2023 18:25:52 +0000 Subject: [PATCH] feat(client-transcribe): Added API argument --toxicity-detection to startTranscriptionJob API, which allows users to view toxicity scores of submitted audio. --- .../commands/GetTranscriptionJobCommand.ts | 7 + .../commands/ListTranscriptionJobsCommand.ts | 7 + .../commands/StartTranscriptionJobCommand.ts | 14 + .../client-transcribe/src/models/models_0.ts | 49 +++ .../src/protocols/Aws_json1_1.ts | 16 + .../sdk-codegen/aws-models/transcribe.json | 288 ++++++++++++------ 6 files changed, 296 insertions(+), 85 deletions(-) diff --git a/clients/client-transcribe/src/commands/GetTranscriptionJobCommand.ts b/clients/client-transcribe/src/commands/GetTranscriptionJobCommand.ts index c26a6886853c..44a944228338 100644 --- a/clients/client-transcribe/src/commands/GetTranscriptionJobCommand.ts +++ b/clients/client-transcribe/src/commands/GetTranscriptionJobCommand.ts @@ -134,6 +134,13 @@ export interface GetTranscriptionJobCommandOutput extends GetTranscriptionJobRes * // LanguageModelName: "STRING_VALUE", * // }, * // }, + * // ToxicityDetection: [ // ToxicityDetection + * // { // ToxicityDetectionSettings + * // ToxicityCategories: [ // ToxicityCategories // required + * // "ALL", + * // ], + * // }, + * // ], * // }, * // }; * diff --git a/clients/client-transcribe/src/commands/ListTranscriptionJobsCommand.ts b/clients/client-transcribe/src/commands/ListTranscriptionJobsCommand.ts index bea7fb5baf9b..4453ed92e03e 100644 --- a/clients/client-transcribe/src/commands/ListTranscriptionJobsCommand.ts +++ b/clients/client-transcribe/src/commands/ListTranscriptionJobsCommand.ts @@ -85,6 +85,13 @@ export interface ListTranscriptionJobsCommandOutput extends ListTranscriptionJob * // DurationInSeconds: Number("float"), * // }, * // ], + * // ToxicityDetection: [ // ToxicityDetection + * // { // ToxicityDetectionSettings + * // ToxicityCategories: [ // ToxicityCategories // required + * // "ALL", + * // ], + * // }, + * // ], * // }, * // ], * // }; diff --git a/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts b/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts index 5a6d0e7a66c6..a0aeed1dd3ab 100644 --- a/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts +++ b/clients/client-transcribe/src/commands/StartTranscriptionJobCommand.ts @@ -140,6 +140,13 @@ export interface StartTranscriptionJobCommandOutput extends StartTranscriptionJo * LanguageModelName: "STRING_VALUE", * }, * }, + * ToxicityDetection: [ // ToxicityDetection + * { // ToxicityDetectionSettings + * ToxicityCategories: [ // ToxicityCategories // required + * "ALL", + * ], + * }, + * ], * }; * const command = new StartTranscriptionJobCommand(input); * const response = await client.send(command); @@ -220,6 +227,13 @@ export interface StartTranscriptionJobCommandOutput extends StartTranscriptionJo * // LanguageModelName: "STRING_VALUE", * // }, * // }, + * // ToxicityDetection: [ // ToxicityDetection + * // { // ToxicityDetectionSettings + * // ToxicityCategories: [ // ToxicityCategories // required + * // "ALL", + * // ], + * // }, + * // ], * // }, * // }; * diff --git a/clients/client-transcribe/src/models/models_0.ts b/clients/client-transcribe/src/models/models_0.ts index 9b51e3c37e60..d21d7fbf57be 100644 --- a/clients/client-transcribe/src/models/models_0.ts +++ b/clients/client-transcribe/src/models/models_0.ts @@ -2770,6 +2770,34 @@ export interface SubtitlesOutput { OutputStartIndex?: number; } +/** + * @public + * @enum + */ +export const ToxicityCategory = { + ALL: "ALL", +} as const; + +/** + * @public + */ +export type ToxicityCategory = (typeof ToxicityCategory)[keyof typeof ToxicityCategory]; + +/** + * @public + *

Contains ToxicityCategories, which is a required parameter if you + * want to enable toxicity detection (ToxicityDetection) in your transcription + * request.

+ */ +export interface ToxicityDetectionSettings { + /** + *

If you include ToxicityDetection in your transcription request, you + * must also include ToxicityCategories. The only accepted value for this + * parameter is ALL.

+ */ + ToxicityCategories: (ToxicityCategory | string)[] | undefined; +} + /** * @public *

Provides detailed information about a transcription job.

@@ -2977,6 +3005,11 @@ export interface TranscriptionJob { * custom vocabulary filters that you included in your request.

*/ LanguageIdSettings?: Record; + + /** + *

Provides information about the toxicity detection settings applied to your transcription.

+ */ + ToxicityDetection?: ToxicityDetectionSettings[]; } /** @@ -3677,6 +3710,12 @@ export interface TranscriptionJobSummary { * of this parameter, LanguageCode, is present.

*/ LanguageCodes?: LanguageCodeItem[]; + + /** + *

Indicates whether toxicity detection was enabled for the specified transcription + * job.

+ */ + ToxicityDetection?: ToxicityDetectionSettings[]; } /** @@ -4508,6 +4547,16 @@ export interface StartTranscriptionJobRequest { * sub-parameter.

*/ LanguageIdSettings?: Record; + + /** + *

Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also include + * ToxicityCategories.

+ *

For information on the types of toxic speech Amazon Transcribe can detect, see + * Detecting toxic + * speech.

+ */ + ToxicityDetection?: ToxicityDetectionSettings[]; } /** diff --git a/clients/client-transcribe/src/protocols/Aws_json1_1.ts b/clients/client-transcribe/src/protocols/Aws_json1_1.ts index 020cdfcd256b..612c8168542c 100644 --- a/clients/client-transcribe/src/protocols/Aws_json1_1.ts +++ b/clients/client-transcribe/src/protocols/Aws_json1_1.ts @@ -245,6 +245,8 @@ import { Subtitles, Tag, TagResourceRequest, + ToxicityCategory, + ToxicityDetectionSettings, TranscriptFilter, TranscriptionJob, TranscriptionJobSummary, @@ -3074,6 +3076,12 @@ const de_NotFoundExceptionRes = async (parsedOutput: any, context: __SerdeContex // se_TagResourceRequest omitted. +// se_ToxicityCategories omitted. + +// se_ToxicityDetection omitted. + +// se_ToxicityDetectionSettings omitted. + // se_TranscriptFilter omitted. // se_UntagResourceRequest omitted. @@ -3611,6 +3619,12 @@ const de_StartTranscriptionJobResponse = (output: any, context: __SerdeContext): // de_TagResourceResponse omitted. +// de_ToxicityCategories omitted. + +// de_ToxicityDetection omitted. + +// de_ToxicityDetectionSettings omitted. + // de_Transcript omitted. // de_TranscriptFilter omitted. @@ -3640,6 +3654,7 @@ const de_TranscriptionJob = (output: any, context: __SerdeContext): Transcriptio StartTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), Subtitles: _json, Tags: _json, + ToxicityDetection: _json, Transcript: _json, TranscriptionJobName: __expectString, TranscriptionJobStatus: __expectString, @@ -3675,6 +3690,7 @@ const de_TranscriptionJobSummary = (output: any, context: __SerdeContext): Trans ModelSettings: _json, OutputLocationType: __expectString, StartTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + ToxicityDetection: _json, TranscriptionJobName: __expectString, TranscriptionJobStatus: __expectString, }) as any; diff --git a/codegen/sdk-codegen/aws-models/transcribe.json b/codegen/sdk-codegen/aws-models/transcribe.json index 3301dd2ccb8c..9c9feb8b6b88 100644 --- a/codegen/sdk-codegen/aws-models/transcribe.json +++ b/codegen/sdk-codegen/aws-models/transcribe.json @@ -4604,6 +4604,12 @@ "traits": { "smithy.api#documentation": "

If using automatic language identification in your request and you want to apply a\n custom language model, a custom vocabulary, or a custom vocabulary filter, include\n LanguageIdSettings with the relevant sub-parameters\n (VocabularyName, LanguageModelName, and\n VocabularyFilterName). Note that multi-language identification\n (IdentifyMultipleLanguages) doesn't support custom language\n models.

\n

\n LanguageIdSettings supports two to five language codes. Each language\n code you include can have an associated custom language model, custom vocabulary, and\n custom vocabulary filter. The language codes that you specify must match the languages\n of the associated custom language models, custom vocabularies, and custom vocabulary\n filters.

\n

It's recommended that you include LanguageOptions when using\n LanguageIdSettings to ensure that the correct language dialect is\n identified. For example, if you specify a custom vocabulary that is in\n en-US but Amazon Transcribe determines that the language spoken in\n your media is en-AU, your custom vocabulary is not\n applied to your transcription. If you include LanguageOptions and include\n en-US as the only English language dialect, your custom vocabulary\n is applied to your transcription.

\n

If you want to include a custom language model with your request but do not want to use automatic language identification, use\n instead the parameter with the\n LanguageModelName sub-parameter. If you want to include a custom\n vocabulary or a custom vocabulary filter (or both) with your request but do not want to use automatic language identification, use\n instead the parameter with the\n VocabularyName or VocabularyFilterName (or both)\n sub-parameter.

" } + }, + "ToxicityDetection": { + "target": "com.amazonaws.transcribe#ToxicityDetection", + "traits": { + "smithy.api#documentation": "

Enables toxic speech detection in your transcript. If you include \n ToxicityDetection in your request, you must also include\n ToxicityCategories.

\n

For information on the types of toxic speech Amazon Transcribe can detect, see \n Detecting toxic\n speech.

" + } } }, "traits": { @@ -4859,6 +4865,56 @@ } } }, + "com.amazonaws.transcribe#ToxicityCategories": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribe#ToxicityCategory" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1 + } + } + }, + "com.amazonaws.transcribe#ToxicityCategory": { + "type": "enum", + "members": { + "ALL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ALL" + } + } + } + }, + "com.amazonaws.transcribe#ToxicityDetection": { + "type": "list", + "member": { + "target": "com.amazonaws.transcribe#ToxicityDetectionSettings" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1 + } + } + }, + "com.amazonaws.transcribe#ToxicityDetectionSettings": { + "type": "structure", + "members": { + "ToxicityCategories": { + "target": "com.amazonaws.transcribe#ToxicityCategories", + "traits": { + "smithy.api#documentation": "

If you include ToxicityDetection in your transcription request, you \n must also include ToxicityCategories. The only accepted value for this \n parameter is ALL.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains ToxicityCategories, which is a required parameter if you \n want to enable toxicity detection (ToxicityDetection) in your transcription \n request.

" + } + }, "com.amazonaws.transcribe#Transcribe": { "type": "service", "version": "2017-10-26", @@ -5443,9 +5499,9 @@ } }, "params": { + "Region": "af-south-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "af-south-1" + "UseDualStack": false } }, { @@ -5456,9 +5512,9 @@ } }, "params": { + "Region": "ap-east-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "ap-east-1" + "UseDualStack": false } }, { @@ -5469,9 +5525,9 @@ } }, "params": { + "Region": "ap-northeast-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "ap-northeast-1" + "UseDualStack": false } }, { @@ -5482,9 +5538,9 @@ } }, "params": { + "Region": "ap-northeast-2", "UseFIPS": false, - "UseDualStack": false, - "Region": "ap-northeast-2" + "UseDualStack": false } }, { @@ -5495,9 +5551,9 @@ } }, "params": { + "Region": "ap-south-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "ap-south-1" + "UseDualStack": false } }, { @@ -5508,9 +5564,9 @@ } }, "params": { + "Region": "ap-southeast-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "ap-southeast-1" + "UseDualStack": false } }, { @@ -5521,9 +5577,9 @@ } }, "params": { + "Region": "ap-southeast-2", "UseFIPS": false, - "UseDualStack": false, - "Region": "ap-southeast-2" + "UseDualStack": false } }, { @@ -5534,9 +5590,9 @@ } }, "params": { + "Region": "ca-central-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "ca-central-1" + "UseDualStack": false } }, { @@ -5547,9 +5603,9 @@ } }, "params": { + "Region": "ca-central-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "ca-central-1" + "UseDualStack": false } }, { @@ -5560,9 +5616,9 @@ } }, "params": { + "Region": "eu-central-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "eu-central-1" + "UseDualStack": false } }, { @@ -5573,9 +5629,9 @@ } }, "params": { + "Region": "eu-north-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "eu-north-1" + "UseDualStack": false } }, { @@ -5586,9 +5642,9 @@ } }, "params": { + "Region": "eu-west-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "eu-west-1" + "UseDualStack": false } }, { @@ -5599,9 +5655,9 @@ } }, "params": { + "Region": "eu-west-2", "UseFIPS": false, - "UseDualStack": false, - "Region": "eu-west-2" + "UseDualStack": false } }, { @@ -5612,9 +5668,9 @@ } }, "params": { + "Region": "eu-west-3", "UseFIPS": false, - "UseDualStack": false, - "Region": "eu-west-3" + "UseDualStack": false } }, { @@ -5625,9 +5681,9 @@ } }, "params": { + "Region": "me-south-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "me-south-1" + "UseDualStack": false } }, { @@ -5638,9 +5694,9 @@ } }, "params": { + "Region": "sa-east-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "sa-east-1" + "UseDualStack": false } }, { @@ -5651,9 +5707,9 @@ } }, "params": { + "Region": "us-east-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-east-1" + "UseDualStack": false } }, { @@ -5664,9 +5720,9 @@ } }, "params": { + "Region": "us-east-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-east-1" + "UseDualStack": false } }, { @@ -5677,9 +5733,9 @@ } }, "params": { + "Region": "us-east-2", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-east-2" + "UseDualStack": false } }, { @@ -5690,9 +5746,9 @@ } }, "params": { + "Region": "us-east-2", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-east-2" + "UseDualStack": false } }, { @@ -5703,9 +5759,9 @@ } }, "params": { + "Region": "us-west-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-west-1" + "UseDualStack": false } }, { @@ -5716,9 +5772,9 @@ } }, "params": { + "Region": "us-west-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-west-1" + "UseDualStack": false } }, { @@ -5729,9 +5785,9 @@ } }, "params": { + "Region": "us-west-2", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-west-2" + "UseDualStack": false } }, { @@ -5742,9 +5798,9 @@ } }, "params": { + "Region": "us-west-2", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-west-2" + "UseDualStack": false } }, { @@ -5755,9 +5811,9 @@ } }, "params": { + "Region": "us-east-1", "UseFIPS": true, - "UseDualStack": true, - "Region": "us-east-1" + "UseDualStack": true } }, { @@ -5768,9 +5824,9 @@ } }, "params": { + "Region": "us-east-1", "UseFIPS": false, - "UseDualStack": true, - "Region": "us-east-1" + "UseDualStack": true } }, { @@ -5781,9 +5837,9 @@ } }, "params": { + "Region": "cn-north-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "cn-north-1" + "UseDualStack": false } }, { @@ -5794,9 +5850,9 @@ } }, "params": { + "Region": "cn-northwest-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "cn-northwest-1" + "UseDualStack": false } }, { @@ -5807,9 +5863,9 @@ } }, "params": { + "Region": "cn-north-1", "UseFIPS": true, - "UseDualStack": true, - "Region": "cn-north-1" + "UseDualStack": true } }, { @@ -5820,9 +5876,9 @@ } }, "params": { + "Region": "cn-north-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "cn-north-1" + "UseDualStack": false } }, { @@ -5833,9 +5889,9 @@ } }, "params": { + "Region": "cn-north-1", "UseFIPS": false, - "UseDualStack": true, - "Region": "cn-north-1" + "UseDualStack": true } }, { @@ -5846,9 +5902,9 @@ } }, "params": { + "Region": "us-gov-east-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-gov-east-1" + "UseDualStack": false } }, { @@ -5859,9 +5915,9 @@ } }, "params": { + "Region": "us-gov-east-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-gov-east-1" + "UseDualStack": false } }, { @@ -5872,9 +5928,9 @@ } }, "params": { + "Region": "us-gov-west-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-gov-west-1" + "UseDualStack": false } }, { @@ -5885,9 +5941,9 @@ } }, "params": { + "Region": "us-gov-west-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-gov-west-1" + "UseDualStack": false } }, { @@ -5898,9 +5954,9 @@ } }, "params": { + "Region": "us-gov-east-1", "UseFIPS": true, - "UseDualStack": true, - "Region": "us-gov-east-1" + "UseDualStack": true } }, { @@ -5911,9 +5967,9 @@ } }, "params": { + "Region": "us-gov-east-1", "UseFIPS": false, - "UseDualStack": true, - "Region": "us-gov-east-1" + "UseDualStack": true } }, { @@ -5924,9 +5980,20 @@ } }, "params": { + "Region": "us-iso-east-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-iso-east-1" + "UseDualStack": false + } + }, + { + "documentation": "For region us-iso-east-1 with FIPS enabled and DualStack enabled", + "expect": { + "error": "FIPS and DualStack are enabled, but this partition does not support one or both" + }, + "params": { + "Region": "us-iso-east-1", + "UseFIPS": true, + "UseDualStack": true } }, { @@ -5937,9 +6004,31 @@ } }, "params": { + "Region": "us-iso-east-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-iso-east-1" + "UseDualStack": false + } + }, + { + "documentation": "For region us-iso-east-1 with FIPS disabled and DualStack enabled", + "expect": { + "error": "DualStack is enabled but this partition does not support DualStack" + }, + "params": { + "Region": "us-iso-east-1", + "UseFIPS": false, + "UseDualStack": true + } + }, + { + "documentation": "For region us-isob-east-1 with FIPS enabled and DualStack enabled", + "expect": { + "error": "FIPS and DualStack are enabled, but this partition does not support one or both" + }, + "params": { + "Region": "us-isob-east-1", + "UseFIPS": true, + "UseDualStack": true } }, { @@ -5950,9 +6039,20 @@ } }, "params": { + "Region": "us-isob-east-1", "UseFIPS": true, - "UseDualStack": false, - "Region": "us-isob-east-1" + "UseDualStack": false + } + }, + { + "documentation": "For region us-isob-east-1 with FIPS disabled and DualStack enabled", + "expect": { + "error": "DualStack is enabled but this partition does not support DualStack" + }, + "params": { + "Region": "us-isob-east-1", + "UseFIPS": false, + "UseDualStack": true } }, { @@ -5963,9 +6063,9 @@ } }, "params": { + "Region": "us-isob-east-1", "UseFIPS": false, - "UseDualStack": false, - "Region": "us-isob-east-1" + "UseDualStack": false } }, { @@ -5976,9 +6076,9 @@ } }, "params": { + "Region": "us-east-1", "UseFIPS": false, "UseDualStack": false, - "Region": "us-east-1", "Endpoint": "https://example.com" } }, @@ -6001,9 +6101,9 @@ "error": "Invalid Configuration: FIPS and custom endpoint are not supported" }, "params": { + "Region": "us-east-1", "UseFIPS": true, "UseDualStack": false, - "Region": "us-east-1", "Endpoint": "https://example.com" } }, @@ -6013,11 +6113,17 @@ "error": "Invalid Configuration: Dualstack and custom endpoint are not supported" }, "params": { + "Region": "us-east-1", "UseFIPS": false, "UseDualStack": true, - "Region": "us-east-1", "Endpoint": "https://example.com" } + }, + { + "documentation": "Missing region", + "expect": { + "error": "Invalid Configuration: Missing Region" + } } ], "version": "1.0" @@ -6251,6 +6357,12 @@ "traits": { "smithy.api#documentation": "

Provides the name and language of all custom language models, custom vocabularies, and\n custom vocabulary filters that you included in your request.

" } + }, + "ToxicityDetection": { + "target": "com.amazonaws.transcribe#ToxicityDetection", + "traits": { + "smithy.api#documentation": "

Provides information about the toxicity detection settings applied to your transcription.

" + } } }, "traits": { @@ -6385,6 +6497,12 @@ "traits": { "smithy.api#documentation": "

The language codes used to create your transcription job. This parameter is used with\n multi-language identification. For single-language identification, the singular version\n of this parameter, LanguageCode, is present.

" } + }, + "ToxicityDetection": { + "target": "com.amazonaws.transcribe#ToxicityDetection", + "traits": { + "smithy.api#documentation": "

Indicates whether toxicity detection was enabled for the specified transcription \n job.

" + } } }, "traits": {