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
AI_TRANSLATE(text, source, target);''as source auto detects; 23 languages; 100,000 input tokens.AI_TRANSCRIBEtakes aFILE;timestamp_granularityis'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_TRANSLATEconverts text from one language to another.AI_TRANSCRIBEconverts speech in staged audio or video files into text.AI_REDACTfinds 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.
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_granularity | Result |
|---|---|
| Omitted | One 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.
"Who said what in a call recording" means timestamp_granularity of 'speaker'.
AI_REDACT
AI_REDACT(<input> [, <categories>] [, <return_error_details>] [, <mode>])
| Argument | Meaning |
|---|---|
input | VARCHAR text that may contain PII |
categories | Optional array; if omitted all supported categories are redacted; an unsupported category raises an error |
mode | redact (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
| Function | Default on a failed row |
|---|---|
AI_TRANSLATE, AI_TRANSCRIBE | NULL; the query continues |
AI_REDACT | The 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.
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_TRANSCRIBEtakes aFILE;timestamp_granularityis'word'or'speaker'; 700 MB file limit.- Transcription limit: 60 minutes with timestamps, 120 without.
AI_REDACThas modesredactanddetectand 13 categories.AI_REDACTfails the query on a row error by default.
Check yourself
How do you let
AI_TRANSLATEdetect the source language?Pass an empty string
''assource_language.Which option labels who is speaking in a transcript?
timestamp_granularityset to'speaker'.How do you find where PII sits without changing the text?
Call
AI_REDACTwithmodeset todetect, which returns aspansarray.
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.