Skip to content

Commit

Permalink
feat(client-transcribe): Added API argument --toxicity-detection to s…
Browse files Browse the repository at this point in the history
…tartTranscriptionJob API, which allows users to view toxicity scores of submitted audio.
  • Loading branch information
awstools committed Jul 20, 2023
1 parent b0593ab commit 9e7552a
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ export interface GetTranscriptionJobCommandOutput extends GetTranscriptionJobRes
* // LanguageModelName: "STRING_VALUE",
* // },
* // },
* // ToxicityDetection: [ // ToxicityDetection
* // { // ToxicityDetectionSettings
* // ToxicityCategories: [ // ToxicityCategories // required
* // "ALL",
* // ],
* // },
* // ],
* // },
* // };
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export interface ListTranscriptionJobsCommandOutput extends ListTranscriptionJob
* // DurationInSeconds: Number("float"),
* // },
* // ],
* // ToxicityDetection: [ // ToxicityDetection
* // { // ToxicityDetectionSettings
* // ToxicityCategories: [ // ToxicityCategories // required
* // "ALL",
* // ],
* // },
* // ],
* // },
* // ],
* // };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -220,6 +227,13 @@ export interface StartTranscriptionJobCommandOutput extends StartTranscriptionJo
* // LanguageModelName: "STRING_VALUE",
* // },
* // },
* // ToxicityDetection: [ // ToxicityDetection
* // { // ToxicityDetectionSettings
* // ToxicityCategories: [ // ToxicityCategories // required
* // "ALL",
* // ],
* // },
* // ],
* // },
* // };
*
Expand Down
49 changes: 49 additions & 0 deletions clients/client-transcribe/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>Contains <code>ToxicityCategories</code>, which is a required parameter if you
* want to enable toxicity detection (<code>ToxicityDetection</code>) in your transcription
* request.</p>
*/
export interface ToxicityDetectionSettings {
/**
* <p> If you include <code>ToxicityDetection</code> in your transcription request, you
* must also include <code>ToxicityCategories</code>. The only accepted value for this
* parameter is <code>ALL</code>.</p>
*/
ToxicityCategories: (ToxicityCategory | string)[] | undefined;
}

/**
* @public
* <p>Provides detailed information about a transcription job.</p>
Expand Down Expand Up @@ -2977,6 +3005,11 @@ export interface TranscriptionJob {
* custom vocabulary filters that you included in your request.</p>
*/
LanguageIdSettings?: Record<string, LanguageIdSettings>;

/**
* <p>Provides information about the toxicity detection settings applied to your transcription.</p>
*/
ToxicityDetection?: ToxicityDetectionSettings[];
}

/**
Expand Down Expand Up @@ -3677,6 +3710,12 @@ export interface TranscriptionJobSummary {
* of this parameter, <code>LanguageCode</code>, is present.</p>
*/
LanguageCodes?: LanguageCodeItem[];

/**
* <p>Indicates whether toxicity detection was enabled for the specified transcription
* job.</p>
*/
ToxicityDetection?: ToxicityDetectionSettings[];
}

/**
Expand Down Expand Up @@ -4508,6 +4547,16 @@ export interface StartTranscriptionJobRequest {
* sub-parameter.</p>
*/
LanguageIdSettings?: Record<string, LanguageIdSettings>;

/**
* <p>Enables toxic speech detection in your transcript. If you include
* <code>ToxicityDetection</code> in your request, you must also include
* <code>ToxicityCategories</code>.</p>
* <p>For information on the types of toxic speech Amazon Transcribe can detect, see
* <a href="https://docs.aws.amazon.com/transcribe/latest/dg/toxic-language.html">Detecting toxic
* speech</a>.</p>
*/
ToxicityDetection?: ToxicityDetectionSettings[];
}

/**
Expand Down
16 changes: 16 additions & 0 deletions clients/client-transcribe/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ import {
Subtitles,
Tag,
TagResourceRequest,
ToxicityCategory,
ToxicityDetectionSettings,
TranscriptFilter,
TranscriptionJob,
TranscriptionJobSummary,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 9e7552a

Please sign in to comment.