Skip to main content

Translate Text

Translates text between different languages using OpenAI models.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Connection Id - The connection ID for the OpenAI service.
  • Input Text - The text to translate.

Options

  • Source Language - The language of the input text. Default is English.
  • Destination Language - The language to translate the text into. Default is Spanish.
  • Model - The OpenAI model to use for translation. Options include:
    • gpt-3.5-turbo
    • gpt-3.5-turbo-instruct
    • gpt-4-turbo
    • gpt-4
    • gpt-4-32k
  • Max Tokens - The maximum number of tokens to generate in the completion.
  • Timeout (sec) - Timeout for the request. Only available with Robomotion Credits. Leave blank for default value (120+).

Output

  • Translated Text - The translated version of the input text.

How It Works

The Translate Text node uses OpenAI models to translate text between different languages. When executed, the node:

  1. Validates the provided Connection Id
  2. Prepares a system prompt instructing the model to translate text from the source language to the destination language
  3. Sends the input text along with the prompt to the selected OpenAI model
  4. Processes the model's response to extract the translated text
  5. Returns the translated text as output

Requirements

  • A valid OpenAI API key or Robomotion Credits
  • An active OpenAI connection
  • Input text to translate

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Connection Id
  • Empty or invalid Input Text
  • Invalid Max Tokens value
  • OpenAI API errors
  • Timeout errors

Usage Notes

  • The default source language is English and the default destination language is Spanish
  • The default model is gpt-3.5-turbo, which provides a good balance of performance and cost
  • The Max Tokens option can be adjusted based on the length of the input text
  • For best results, specify the correct source and destination languages
  • When using Robomotion Credits, the timeout can be customized for better performance