DeepsetDeepLTextTranslator

Translate text using DeepL Python SDK.

Basic Information

  • Pipeline type: Indexing and Query
  • 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

NameTypeDescription
textStringThe text to be translated.

Outputs

NameTypeDescription
textStringThe translated text.
metaDictionaryThe 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 Cloud on the Connections page:

  1. Click your initials in the top right corner and select Connections.

  2. Click Connect next to the provider.

  3. Enter your user access token and submit it.

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

Init Parameters

ParameterTypePossible valuesDescription
target_languageList of stringsFor a list of possible options, see DeepL documentation.Codes of languages you want to translate your documents into.
Required.
source_languageStringDefault: NoneThe language of the documents you want to translate. If None, it's automatically detected. For a list of possible options, see DeepL documentation.
Optional.
api_keySecretDefault: Secret.from_env_var("DEEPL_API_TOKEN")The DeepL API key.
Required.
preserve_formattingBooleanDefault: TrueControls automatic formatting correction. When True, prevents automatic correction of formatting.
Optional
contextStringDefault: NoneUse this parameter 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 details, see DeepL API documentation.
Optional.
formalityStringless
more
Default: None
Controls whether translations lean toward informal or formal language. This works only for target languages: German (DE), French (FR), Italian (IT), Spanish (ES), Dutch (NL), Polish (PL), Portugese (PT_BR and PT_PT), Japanese (JA), and Russian (RU). Possible values:

- less: Uses more informal language
- more: Uses more polite and formal language.
Optional.
max_retriesIntegerDefault: 5The maximum number of network retries after a failed HTTP request.
Optional.