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
Name | Type | Description |
---|---|---|
documents | List of Document objects | A list of documents to be translated. |
Outputs
Name | Type | Description |
---|---|---|
translated_documents | List of Document objects | A 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:
-
Click your initials in the top right corner and select Connections.
-
Click Connect next to the provider.
-
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
Parameter | Type | Possible values | Description |
---|---|---|---|
target_languages | 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 |
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. |
Updated about 2 months ago