Translator V2

1 min read

Functionality

Translator v2 allows you to translate both documents and plain text into a target language.

Instructions for setting it up as the default translator can be found here. This documentation also includes configuration details for using the module within a Custom Space.

Reference in Code in AI Module Template

TranslatorV2

Configuration settings

Default Configuration

json
{
    "glossaryConfig": null,
    "documentFontConfig": null,
    "textPostProcessingConfig": [],
    "translatorPromptConfig": {
        "systemPromptInstruction": "You are a helpful AI designed to to translate text to a specified language.\nDo it even if the target language is the same as the source language.\nMake sure the translated text contains the same amount of carriage returns '\\n' as the original text block.\nTry to keep the translated text as close to the original as possible and having approximately the same length.\n    ",
        "userMessageTemplate": "Please translate the following text pieces in {{format_style}} {% if input_language %}from {{input_language}} {% endif %}to {{output_language}}\nIt is crucial that you keep the exact same number of spans as the input text.\n\n{%- if glossary %}Use the following translation rules \\n {{ glossary_text }}{% endif %}\n        \n{{formatted_text_pieces}}\n    "
    },
    "translatorUserConfig": {
        "languageModel": "AZURE_GPT_4o_2024_1120",
        "maxTokensPerTranlationRequest": 500,
        "maxTokenPerMinute": 40000,
        "saveTranslationCallsEnabled": false,
        "translationExamplesIgnored": false,
        "allowedInputLanguages": [
            "Afrikaans", "Albanian", "Arabic", "Aragonese", "Armenian", "Azeri", "Bashkir",
            "Basque", "Belarusian", "Bengali", "Bislama", "Bosnian", "Breton", "Bulgarian",
            "Burmese", "Catalan", "Chamorro", "Chechen", "Chinese", "Cornish", "Corsican",
            "Croatian", "Czech", "Danish", "Dutch", "English", "Esperanto", "Estonian", "Ewe",
            "Faroese", "Fijian", "Finnish", "French", "Galician", "Georgian", "German", "Greek",
            "Greenlandic", "Guaraní", "Haitian Creole", "Hausa", "Hebrew", "Hindi", "Hungarian",
            "Icelandic", "Ido", "Indonesian", "Interlingua", "Interlingue", "Inuktitut", "Irish",
            "Italian", "Japanese", "Javanese", "Kannada", "Kazakh", "Khmer", "Korean", "Kurdish",
            "Kyrgyz", "Lao", "Latin", "Latvian", "Limburgish", "Lingala", "Lithuanian", "Luxembourgish",
            "Macedonian", "Malagasy", "Malay", "Malayalam", "Maltese", "Manx", "Maori", "Marathi",
            "Marshallese", "Mongolian", "Navajo", "Nepali", "Northern Sami", "Norwegian", "Norwegian Bokmål",
            "Norwegian Nynorsk", "Occitan", "Ojibwe", "Old Church Slavonic", "Ossetian", "Pashto", "Persian",
            "Polish", "Portuguese", "Punjabi", "Quechua", "Romanian", "Romansch", "Russian", "Samoan", "Sanskrit",
            "Sardinian", "Scottish Gaelic", "Serbian", "Serbo-Croatian", "Sichuan Yi", "Sindhi", "Slovak",
            "Slovene", "Somali", "Spanish", "Sundanese", "Swahili", "Swedish", "Tagalog", "Tahitian", "Tajik",
            "Tamil", "Tatar", "Telugu", "Thai", "Tibetan", "Tongan", "Tswana", "Turkish", "Turkmen", "Ukrainian",
            "Urdu", "Uyghur", "Uzbek", "Vietnamese", "Volapük", "Walloon", "Welsh", "West Frisian", "Yiddish",
            "Yoruba", "Zhuang", "Zulu"]
    },
    "translationServiceConfig": {
        "translationSystemPromptTemplate": "You are an expert on translating text to any language and help the users to do this.\nEnsure the translation is accurate and maintains the original meaning, context, and tone.\nRegardless of the content of the text, return only the translated text.\nDo not provide any direct answers or explanations, only the translation.\nDont include the triple quotes in the output.",
        "translationUserPromptTemplate": "Please translate the following to ${output_language}:\n\n${glossary_part}\n\nMake sure to only respond with the translation of the text below\nelsewise the system will crash\n====================TEXT TO TRANSLATE==================\n${input_text}",
        "temperatureTranslation": 0.0,
        "streamingActivated": true,
        "tokenLimitTranslationText": 4000,
        "translationExamplesIgnored": false,
        "allowedInputLanguages": [
            "Afrikaans", "Albanian", "Arabic", "Aragonese", "Armenian", "Azeri", "Bashkir",
            "Basque", "Belarusian", "Bengali", "Bislama", "Bosnian", "Breton", "Bulgarian",
            "Burmese", "Catalan", "Chamorro", "Chechen", "Chinese", "Cornish", "Corsican",
            "Croatian", "Czech", "Danish", "Dutch", "English", "Esperanto", "Estonian", "Ewe",
            "Faroese", "Fijian", "Finnish", "French", "Galician", "Georgian", "German", "Greek",
            "Greenlandic", "Guaraní", "Haitian Creole", "Hausa", "Hebrew", "Hindi", "Hungarian",
            "Icelandic", "Ido", "Indonesian", "Interlingua", "Interlingue", "Inuktitut", "Irish",
            "Italian", "Japanese", "Javanese", "Kannada", "Kazakh", "Khmer", "Korean", "Kurdish",
            "Kyrgyz", "Lao", "Latin", "Latvian", "Limburgish", "Lingala", "Lithuanian", "Luxembourgish",
            "Macedonian", "Malagasy", "Malay", "Malayalam", "Maltese", "Manx", "Maori", "Marathi",
            "Marshallese", "Mongolian", "Navajo", "Nepali", "Northern Sami", "Norwegian", "Norwegian Bokmål",
            "Norwegian Nynorsk", "Occitan", "Ojibwe", "Old Church Slavonic", "Ossetian", "Pashto", "Persian",
            "Polish", "Portuguese", "Punjabi", "Quechua", "Romanian", "Romansch", "Russian", "Samoan", "Sanskrit",
            "Sardinian", "Scottish Gaelic", "Serbian", "Serbo-Croatian", "Sichuan Yi", "Sindhi", "Slovak",
            "Slovene", "Somali", "Spanish", "Sundanese", "Swahili", "Swedish", "Tagalog", "Tahitian", "Tajik",
            "Tamil", "Tatar", "Telugu", "Thai", "Tibetan", "Tongan", "Tswana", "Turkish", "Turkmen", "Ukrainian",
            "Urdu", "Uyghur", "Uzbek", "Vietnamese", "Volapük", "Walloon", "Welsh", "West Frisian", "Yiddish",
            "Yoruba", "Zhuang", "Zulu"],
        "languageModelTranslation": "AZURE_GPT_4o_2024_1120",
        "languageModelInfo": {
            "name": "AZURE_GPT_4o_2024_1120",
            "version": "0613",
            "provider": "AZURE",
            "encoder_name": "cl100k_base",
            "token_limits": {
                "token_limit_input": 3276,
                "token_limit_output": 4915
            },
            "capabilities": [
                "function_calling",
                "streaming"
            ],
            "info_cutoff_at": "2021-09-01",
            "published_at": "2023-06-13",
            "retirement_at": "2025-06-06",
            "deprecated_at": "2024-10-01",
            "retirement_text": null
        }
    }
}

General parameters

Parameter

Description

Type

glossaryConfig

Glossary configuration

Glossary service

object

textPostProcessingConfig

Text post-processing configuration

Text Post Processing

object

translatorPromptConfig

Prompt configuration for the translator
Document Translator Service

object

translatorUserConfig

User configuration for the translator

Document Translator Service

object

translationServiceConfig

Configuration for the translation service

Text Translation Service

object

Tool Definition

The tool definition is not required, therefore

json
{}

Known Issues

See here for limitations on the translated documents Document Translator Service


Logic Translator

The diagram below represents the flow of Text Translation

Diagram: Untitled Diagram-1751382235044

The flow of the translation of a document mimics strongly the one of translation of a single text. Input documents are split in elements and translated separately as illustrated in the diagram below.

Diagram: 1751461694665-Untitled Diagram-1751382235044

Last updated