- Categories:
String & binary functions (AI Functions)
AI_TRANSLATE¶
Note
AI_TRANSLATE is the updated version of TRANSLATE (SNOWFLAKE.CORTEX). For the latest functionality, use AI_TRANSLATE.
Translates the given input text from one supported language to another.
Syntax¶
Arguments¶
textA string containing the text to be translated.
source_languageA string specifying the language code for the language the text is currently in. See Usage notes for a list of supported language codes. If the source language code is an empty string,
'', the source language is automatically detected.target_languageA string specifying the language code into which the text should be translated. See Usage notes for a list of supported language codes.
Returns¶
A string containing a translation of the original text into the target language.
Usage notes¶
The following languages are supported by the AI_TRANSLATE function. Use the corresponding language code for the source and target language.
The AI_TRANSLATE model also supports a mix of different languages in the text being translated (for example,
“Spanglish”). In this case, specify an empty string ('') as the source language to auto-detect the languages
used in the source text.
Language |
Code |
|---|---|
Arabic |
|
Chinese |
|
Croatian |
|
Czech |
|
Dutch |
|
English |
|
Finnish |
|
French: |
|
German |
|
Greek |
|
Hebrew |
|
Hindi |
|
Italian |
|
Japanese |
|
Korean |
|
Norwegian |
|
Polish |
|
Portuguese |
|
Romanian |
|
Russian |
|
Spanish |
|
Swedish |
|
Turkish |
|
Access control requirements¶
Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. See Cortex LLM privileges for more information on this privilege.
Examples¶
The following example translates each row of a table from English to German (in this example, review_content is
a column from the reviews table):
The following example translates a fictitious product review from English to Spanish:
The result of this query is:
The following example translates a call transcript from German to English:
The result is:
Finally, the following example illustrates translating text from two different languages (in this case English and Spanish, or “Spanglish”) to English. Note that the specification of the source language is the empty string, which tells AI_TRANSLATE to automatically detect the language.
This query results in:
Legal notices¶
Refer to Snowflake AI and ML.
Limitations¶
Snowflake Cortex functions do not support dynamic tables.