Skip to main content

DeepsetDeepLTextTranslator

Translates text into the language you choose using the DeepL Python SDK.

Basic Information

  • Type: deepset_cloud_custom_nodes.converters.deepl_translator.DeepsetDeepLTextTranslator
  • Components it can connect with:
    • Any component that accepts string as input or returns string as its output.

Inputs

ParameterTypeDefaultDescription
textstrText to translate.

Outputs

ParameterTypeDefaultDescription
textstrThe translated text.
metaDict[str, Any]The metadata related to the translation, such as the source and target language.

Overview

DeepsetDeepLTextTranslator uses the DeepL Python library to translate text into the languages you specify. For a list of supported languages, see DeepL documentation.

Authorization

You must have an active DeepL account and a DeepL API key to use this component. Connect DeepL to deepset AI Platform on the Integrations page:

Connection Instructions

  1. Click your profile icon in the top right corner and choose Integrations.
    Integrations menu screenshot
  2. Click Connect next to the provider.
  3. Enter your API key and submit it.

Once deepset is connected, you can use DeepsetDeepLTextTranslator without passing the API key in the pipeline YAML.

Usage Example

Initializing the Component

components:
DeepsetDeepLTextTranslator:
type: converters.deepl_translator.DeepsetDeepLTextTranslator
init_parameters:

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
target_languagestrThe code of the language you want to translate into. For a list of codes, see DeepL documentation.
source_languageOptional[str]NoneThe source language code. If None, the source language is auto-detected. For a list of codes, see DeepL documentation.
api_keySecretSecret.from_env_var('DEEPL_API_KEY')DeepL API key.
preserve_formattingOptional[bool]NoneControls automatic formatting correction. If None, prevents automatic correction of formatting.
split_sentencesLiteral[0, 1, 'nonewlines', None]NoneControls how the translation engine should split input into sentences before translation. Sets whether the translation engine should first split the input into sentences. This is enabled by default. Possible values are: - 0: 0 means OFF. No splitting at all, whole input is treated as one sentence. Use this option if the input text is already split into sentences, to prevent the engine from splitting the sentence unintentionally. - 1: 1 means ALL. (default) splits on punctuation and on newlines. - 'nonewlines': splits on punctuation only, ignoring newlines.
contextOptional[str]NoneUse this setting to include additional context that can influence a translation without being translated itself. Providing additional context can potentially improve translation quality, especially for short, low-context source texts such as product names on an e-commerce website, article headlines on a news website, or UI elements. For more information and examples, refer to the DeepL API documentation.
formalityLiteral[None, 'less', 'default', 'more', 'prefer_more', 'prefer_less']NoneControls whether translations should lean toward informal or formal language. This feature currently only works for the following languages DE (German), FR (French), IT (Italian), ES (Spanish), NL (Dutch), PL (Polish), PT-BR and PT-PT (Portuguese), JA (Japanese), and RU (Russian). The available options are: - 'less': Translate using informal language. - 'default': Translate using the default formality. - 'more': Translate using formal language. - 'prefer_more': Translate using formal language if the target language supports formality, otherwise use default formality. - 'prefer_less': Translate using informal language if the target language supports formality, otherwise use default formality.
max_retriesOptional[int]5Maximum number of network retries after a failed HTTP request. Default retries is set to 5.
glossaryUnion[str, None]None(Optional) glossary ID to use for translation. Must match specified source_lang and target_lang.
tag_handlingLiteral[None, 'xml', 'html']None(Optional) Type of tags to parse before translation, only "xml" and "html" are currently available.
outline_detectionOptional[bool]None(Optional) Set to False to disable automatic tag detection.
non_splitting_tagsUnion[str, List[str], None]None(Optional) XML tags that should not split a sentence.
splitting_tagsUnion[str, List[str], None]None(Optional) XML tags that should split a sentence.
ignore_tagsUnion[str, List[str], None]None(Optional) XML tags containing text that should not be translated.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
textstrText to translate.