DeepsetDeepLTextTranslator

Translate text using 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

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 AI Platform on the Integrations page. For details, see Add Integrations.

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

Init Parameters

Parameter

Type

Possible values

Description

target_language

List of strings

For a list of possible options, see DeepL documentation.

Codes of languages you want to translate your documents into.
Required.

source_language

String

Default: None

The 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_key

Secret

Default: Secret.from_env_var("DEEPL_API_TOKEN")

The DeepL API key.
Required.

preserve_formatting

Boolean

Default: True

Controls automatic formatting correction. When True, prevents automatic correction of formatting.
Optional

split_sentences

Literal

0
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.

context

String

Default: None

Use 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.

formality

String

less
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_retries

Integer

Default: 5

The maximum number of network retries after a failed HTTP request.
Optional.

glossary

Union

Default: None

The ID of the glossary to use for translation. Must match specified source_lang and target_lang.
Optional.

tag_handling

Literal

XML
HTML
Default: None

Type of tags to parse before translation. Only XML and HTML are currently supported.
Required.

outline_detection

Boolean

True
False
Default: None

Set to False to disable automatic tag detection.
Optional.

non_splitting_tags

Union of string and list of strings

Default: None

XML tags that should not split a sentence.
Required.

splitting_tags

Union of string and list of strings

Default: None

XML tags that should split a sentence.
Required.

ignore_tags

Union of string and list of strings

Default: None

XML 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.

Run() method parameters take precedence over initialization parameters.


Parameter

Type

Description

text

String

The text to translate.
Required.