Translate OpenAI

Prev Next

A node that translates any input event with a Text attribute. Uses OpenAI with a specialized prompt for translation.

Parameters

name
description
default
Source Language Language of the source text. tr-TR
Target Language Language of the target text en-US
Credential API Key Credential for the OpenAI service empty
OpenAI Model OpenAI Model for the request gpt-3.5-turbo
Prompt The specialized prompt with placeholders used for the translation. You are a professional translation system specialized in ...
Role The role of the speaker you want replaced in the {{role}} placeholder for the prompt
OpenAI Address OpenAI Address, you can also prefer your Azure OpenAI address https://api.openai.com/v1/chat/completions

Inputs

Audio

 none

Events

name description known nodes that generate this event
Any event that has Data.Text Any Text based event. SR Milestone, etc. SR Http, SR Websocket, Translate etc.
Language Change Language Change events that are tagged with either "Source" or "Target" will set their respective languages. Language Identifier, Text Language Identifier, Event Tagger
Language Change notes

The language change event from Language Identifier and Text Language Identifier should be tagged using the Event Tagger Node in order to effectively change this node's language .

Outputs

Audio

 none

Events

name
description
Translation Contains the translated text in Data.Text field.

Remarks

Requirements

The node needs an OpenAI Api key to perform. To learn more about getting an API Key and finding it, you can refer to the OpenAI API page .

After getting your API Key, you can learn about finding and securely using your key following the instructions on this page .

You can also see which models are available through the OpenAI Models page.

Project Structure

The node expects events that have the Text field. Which means the node can be used with any and all SR nodes.
A minimum viable project that utilizes Translate node can be built as such:
image.png

With this project, one can use both Speech recognition and have the text translated to any desired language simultaneously.

Taking this a step further, we can construct a project such as:
image.png

Which recognizes a speech, translates the text into another language, and uses TTS to create simultaneous audio outputs.

Keep This in Mind

Keep in mind that the SR node needs a model in Source Language, and TTS node needs a Voice in the Target Language for this particular case.

Finally, here's a project that manipulates the Translation event so that it is punctuated, filtered, normalized before returning the output.
image.png

Keep This in Mind

Also, keep in mind that the SR node needs to support the Source Language, and Punctuation, Profanity Filter, Normalizer nodes need to support the Target Language.

Detailed Workflow

Utilizes Http calls to OpenAI Api with the provided API Key Credential. Raises a Translation event for every response.

Supported flow types

Stream, Batch

Release Notes

v4.5.0
  • Introduced Node.