Snowflake Gen AI Functions · Topic 7 of 26

AI_TRANSLATE, AI_TRANSCRIBE and AI_REDACT - Language, Audio and PII

Use AI_TRANSLATE for languages, AI_TRANSCRIBE for audio and video, and AI_REDACT to mask PII. Know arguments, limits, return formats and error behavior.

  • 4 min
In a nutshell
  • AI_TRANSLATE(text, source, target); '' as source auto detects; 23 languages; 100,000 input tokens.
  • AI_TRANSCRIBE takes a FILE; timestamp_granularity is 'word' or 'speaker'; 700 MB file limit.
  • Transcription limit: 60 minutes with timestamps, 120 without.

What it is

Three task specific functions change the form of the data rather than analyzing it.

  • AI_TRANSLATE converts text from one language to another.
  • AI_TRANSCRIBE converts speech in staged audio or video files into text.
  • AI_REDACT finds personally identifiable information (PII) in text and masks it, or reports where it is.

They often chain together: transcribe a call recording, translate it, then redact it before it is shared.

Audio fileon a stageTO_FILE and AI_TRANSCRIBETranscripttextAI_TRANSLATEEnglish textAI_REDACTSafe textPII masked

How it works

AI_TRANSLATE

AI_TRANSLATE(<text>, <source_language>, <target_language> [, <return_error_details>])

Languages are given as codes. An empty string '' as the source language auto detects it, including mixed language text. The result is a string.

SELECT AI_TRANSLATE(comment, '', 'en') FROM feedback;

Supported languages (23): Arabic ar, Chinese zh, Croatian hr, Czech cs, Dutch nl, English en, Finnish fi, French fr, German de, Greek el, Hebrew he, Hindi hi, Italian it, Japanese ja, Korean ko, Norwegian no, Polish pl, Portuguese pt, Romanian ro, Russian ru, Spanish es, Swedish sv and Turkish tr.

The limit is 100,000 input tokens. Translations average about one output token per input token, so one request can process roughly 200,000 tokens in total. Snowflake calls AI_TRANSLATE the updated version of TRANSLATE.

AI_TRANSCRIBE

AI_TRANSCRIBE(<audio_file> [, <options>] [, <return_error_details>])

The first argument is a FILE value from TO_FILE. The only option is timestamp_granularity.

timestamp_granularityResult
OmittedOne block of full text, no timestamps
'word'A timestamp for each word
'speaker'A timestamp and speaker label at each speaker change
SELECT AI_TRANSCRIBE(
  TO_FILE('@calls', 'call_17.mp3'),
  {'timestamp_granularity': 'speaker'}
);

The return value is a JSON string with audio_duration in seconds, plus text for the full transcript when no granularity is set, or a segments array in word or speaker mode. Each segment has start, end, text and, for speaker mode, a speaker_label such as SPEAKER_00.

Limits and formats:

  • File size up to 700 MB.
  • Duration up to 60 minutes with word or speaker granularity, and 120 minutes without it.
  • Audio formats include AAC, FLAC, M4A, MP3, MP4, OGG, WAV and WEBM. Video formats include MKV, MOV, MP4, OGV and WEBM, and the video must contain an audio track.
  • Language detection needs speech to begin within the first five seconds, so trim leading silence.
  • Audio is billed at 50 tokens per second.

Availability is limited to a few regions: AWS US West 2, AWS US East 1, AWS EU Central 1 and Azure East US 2.

Exam tip

"Who said what in a call recording" means timestamp_granularity of 'speaker'.

AI_REDACT

AI_REDACT(<input> [, <categories>] [, <return_error_details>] [, <mode>])
ArgumentMeaning
inputVARCHAR text that may contain PII
categoriesOptional array; if omitted all supported categories are redacted; an unsupported category raises an error
moderedact (default) replaces PII with placeholders such as [NAME]; detect returns an object with a spans array and leaves the text unchanged

Supported categories: NAME, EMAIL, PHONE_NUMBER, DATE_OF_BIRTH, GENDER, AGE, ADDRESS, NATIONAL_ID, PASSPORT, TAX_IDENTIFIER, PAYMENT_CARD_DATA, DRIVERS_LICENSE and IP_ADDRESS.

SELECT AI_REDACT(note, ['NAME', 'EMAIL', 'PHONE_NUMBER']) FROM cases;

Key limits:

  • Input and output together are limited to 4,096 tokens, and output to 1,024 tokens. Longer text must be split, for example with SPLIT_TEXT_RECURSIVE_CHARACTER.
  • It works best with well formed English and mainly covers US PII, with some UK and Canadian types.
  • Detection is best effort and can miss PII, so review the output.

Error handling compared

FunctionDefault on a failed row
AI_TRANSLATE, AI_TRANSCRIBENULL; the query continues
AI_REDACTThe whole query fails

For AI_REDACT, set the session parameter AI_SQL_ERROR_HANDLING_USE_FAIL_ON_ERROR to FALSE to get NULL instead. The return_error_details argument needs that setting at FALSE as well.

Watch out

Redaction is not a guarantee. A scenario about compliance should include a review step and not assume every identifier is removed.

Access

All three need the SNOWFLAKE.CORTEX_USER database role, with USE AI FUNCTIONS. AI_COUNT_TOKENS can estimate tokens for AI_REDACT and AI_TRANSLATE before a large run.

Common mistakes

Passing a language name instead of a code. Use fr, de, ja and so on.

Giving AI_TRANSLATE the wrong source on mixed text. An empty string source auto detects.

Sending a 90 minute call with 'speaker' granularity. The limit is 60 minutes with timestamps.

Sending long documents to AI_REDACT in one piece. Split them so each call stays within 4,096 tokens.

Expecting a failed AI_REDACT row to return NULL by default. The query fails unless the session parameter is changed.

What to remember for the exam

  • AI_TRANSLATE(text, source, target); '' as source auto detects; 23 languages; 100,000 input tokens.
  • AI_TRANSCRIBE takes a FILE; timestamp_granularity is 'word' or 'speaker'; 700 MB file limit.
  • Transcription limit: 60 minutes with timestamps, 120 without.
  • AI_REDACT has modes redact and detect and 13 categories.
  • AI_REDACT fails the query on a row error by default.

Check yourself

  • How do you let AI_TRANSLATE detect the source language?

    Pass an empty string '' as source_language.

  • Which option labels who is speaking in a transcript?

    timestamp_granularity set to 'speaker'.

  • How do you find where PII sits without changing the text?

    Call AI_REDACT with mode set to detect, which returns a spans array.

Topic 7 of 26 in Snowflake Gen AI Functions

Test yourself on Snowflake Gen AI Functions

The full Snowflake GES-C02 question bank has 585 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.