DeepsetDeepLDocumentTranslator

Translate the content of your documents using DeepL Python SDK.

Basic Information

  • Pipeline type: Indexing and Query
    When used in an indexing pipeline, it translates documents before they're indexed.
    When used in a query pipeline, it translates documents after they're retrieved from a document store.
  • Type: deepset_cloud_custom_nodes.converters.deepl_document_translator.DeepsetDeepLDocumentTranslator
  • Components it can connect with:
    • Converters: You can use DeepsetDeepLTextTranslator after converters to translate the documents converters return.
    • Retrievers: You can use this component to translate documents fetched by a retriever.
    • PromptBuilder: DeepsetDeepLTextTranslator can send the translated documents to a PromptBuilder, which then includes them in the prompt for the LLM.

Inputs

NameTypeDescription
documentsList of Document objectsA list of documents to be translated.

Outputs

NameTypeDescription
translated_documentsList of Document objectsA list of translated documents.

Overview

DeepsetDeepLDocumentTranslator uses the DeepL Python library to translate documents into the languages you specify. For a list of supported languages, see DeepL documentation. You can translate one set of documents into multiple languages at once; just pass the language codes in the target_languages parameter.

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 DeepsetDeepLDocumentTranslator without passing the API key in the pipeline YAML.

Init Parameters

ParameterTypePossible valuesDescription
target_languagesList 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.