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 API key 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
split_sentencesLiteral0
1
nonewlines
Default: None
Controls 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: 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: means ALL. (default) splits on punctuation and on newlines.
- nonewlines: splits on punctuation only, ignoring newlines.
Required.
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.
glossaryUnionDefault: NoneThe ID of the glossary to use for translation. Must match specified source_lang and target_lang.
Optional.
tag_handlingLiteralXML
HTML
Default: None
Type of tags to parse before translation. Only XML and HTML are currently supported.
Required.
outline_detectionBooleanTrue
False
Default: None
Set to False to disable automatic tag detection.
Optional.
non_splitting_tagsUnion of string and list of stringsDefault: NoneXML tags that should not split a sentence.
Required.
splitting_tagsUnion of string and list of stringsDefault: NoneXML tags that should split a sentence.
Required.
ignore_tagsUnion of string and list of stringsDefault: NoneXML tags containing text that should not be translated.
Required.

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.


ParameterTypeDescription
textStringThe text to translate.
Required.