NVIDIA NMT NIM Microservice API References#

The NMT NIM microservice exposes a gRPC API based on protocol buffers for text-to-text and streaming speech translation. The RivaTranslation service supports synchronous translation between language pairs, language-pair discovery, streaming speech-to-text translation, and streaming speech-to-speech translation.

Top

riva/proto/health.proto#

HealthCheckRequest#

Field

Type

Label

Description

service

string

HealthCheckResponse#

Field

Type

Label

Description

status

HealthCheckResponse.ServingStatus

HealthCheckResponse.ServingStatus#

Name

Number

Description

UNKNOWN

0

SERVING

1

NOT_SERVING

2

Health#

Method Name

Request Type

Response Type

Description

Check

HealthCheckRequest

HealthCheckResponse

Watch

HealthCheckRequest

HealthCheckResponse stream

Top

riva/proto/riva_common.proto#

RequestId#

Specifies the request ID of the request.

Field

Type

Label

Description

value

string

Top

riva/proto/riva_nmt.proto#

AvailableLanguageRequest#

Returns a map of model names to its source and target language pairs. Can specify a specific model name to retrieve only its language pairs.

Field

Type

Label

Description

model

string

Supported values: “s2s_model”, “s2t_model”, and name of the deployed t2t model. If empty, returns all available models and languages.

AvailableLanguageResponse#

Language pairs are the sets of src to tgt languages available per model. languages contains all the model_name -> Language pair

Field

Type

Label

Description

languages

AvailableLanguageResponse.LanguagesEntry

repeated

AvailableLanguageResponse.LanguagePair#

Field

Type

Label

Description

src_lang

string

repeated

tgt_lang

string

repeated

AvailableLanguageResponse.LanguagesEntry#

Field

Type

Label

Description

key

string

value

AvailableLanguageResponse.LanguagePair

TranslateTextRequest#

request for synchronous translation of each text in texts. Available languages can be queried using ListSupportLanguagePairs RPC. source and target languages must be specified, are currently two character ISO codes, this will likely change to BCP-47 inline with other Riva Services for GA.

Field

Type

Label

Description

texts

string

repeated

model

string

source_language

string

target_language

string

dnt_phrases

string

repeated

A list of words or phrases that are not to be translated or to be custom translated by the pipeline. Words to be custom translated should be specified as “<word>##<custom_translation>” and words not be translated should be specified as “<word>”.

max_len_variation

string

Controls the maximum allowed variation in token count between the source text and translated output.

id

nvidia.riva.RequestId

The ID to be associated with the request. If provided, this will be returned in the corresponding response.

StreamingTranslateSpeechToTextRequest#

Streams a configuration message followed by source audio chunks for speech-to-text translation.

Field

Type

Label

Description

config

StreamingTranslateSpeechToTextConfig

oneof

Configuration for the ASR and translation stages.

audio_content

bytes

oneof

A chunk of source audio.

id

nvidia.riva.RequestId

The ID associated with the request.

StreamingTranslateSpeechToSpeechRequest#

Streams a configuration message followed by source audio chunks for an ASR, NMT, and TTS translation pipeline.

Field

Type

Label

Description

config

StreamingTranslateSpeechToSpeechConfig

oneof

Configuration for the ASR, translation, and TTS stages.

audio_content

bytes

oneof

A chunk of source audio.

id

nvidia.riva.RequestId

The ID associated with the request.

TranslateTextResponse#

Translations are returned as text:language pairs. These are 1:1 for the passed in ‘texts’ from the request.

Field

Type

Label

Description

translations

Translation

repeated

id

nvidia.riva.RequestId

The ID associated with the request

StreamingTranslateSpeechToTextResponse#

Returns translated streaming recognition results.

Field

Type

Label

Description

results

nvidia.riva.asr.StreamingRecognitionResult

repeated

Streaming recognition results containing translated text.

id

nvidia.riva.RequestId

The ID associated with the request.

StreamingTranslateSpeechToSpeechResponse#

Returns a synthesized audio chunk. The final response contains an empty audio buffer to mark the end of the stream.

Field

Type

Label

Description

speech

nvidia.riva.tts.SynthesizeSpeechResponse

Synthesized speech from the TTS stage.

id

nvidia.riva.RequestId

The ID associated with the request.

Translation#

contains a single translation, collecting into the translate text response Includes the target language code, since with multi lingual models there are multiple possibilities.

Field

Type

Label

Description

text

string

language

string

TranslationConfig#

Field

Type

Label

Description

source_language_code

string

BCP-47 “en-US”

target_language_code

string

model_name

string

dnt_phrases

string

repeated

A list of words or phrases that will not be translated by the pipeline. This list can include special words or phrases, for example, names, acronyms or any phrases desired to be excluded from translation. These words or phrases will be present as-is in the translated output.

SynthesizeSpeechConfig#

Configures the synthesized audio produced by a speech-to-speech translation pipeline.

Field

Type

Label

Description

encoding

AudioEncoding

Encoding for the synthesized audio.

sample_rate_hz

int32

Sample rate of the synthesized audio in hertz.

voice_name

string

TTS voice name.

language_code

string

BCP-47 target language code, for example, es-US.

prosody_rate

string

Prosody rate.

prosody_pitch

string

Prosody pitch.

prosody_volume

string

Prosody volume.

StreamingTranslateSpeechToTextConfig#

Configures the ASR and translation stages of a streaming speech-to-text translation pipeline.

Field

Type

Label

Description

asr_config

nvidia.riva.asr.StreamingRecognitionConfig

Streaming ASR configuration.

translation_config

TranslationConfig

Translation configuration.

StreamingTranslateSpeechToSpeechConfig#

Configures the ASR, NMT, and TTS stages of a streaming speech-to-speech translation pipeline.

Field

Type

Label

Description

asr_config

nvidia.riva.asr.StreamingRecognitionConfig

Streaming ASR configuration.

tts_config

SynthesizeSpeechConfig

Speech synthesis configuration.

translation_config

TranslationConfig

Translation configuration.

RivaTranslation#

RivaTranslation provides RPCs for text and speech translation between languages.

Method Name

Request Type

Response Type

Description

TranslateText

TranslateTextRequest

TranslateTextResponse

Translate text to text, from a source to a target language. Currently source and target language fields is required, along with the model name. Multiple texts can be passed per request up to the given batch size for the model, which is set at translation pipeline creation time.

ListSupportedLanguagePairs

AvailableLanguageRequest

AvailableLanguageResponse

Lists the available language pairs and models names to be used for TranslateText

StreamingTranslateSpeechToText

StreamingTranslateSpeechToTextRequest stream

StreamingTranslateSpeechToTextResponse stream

Transcribes source audio and streams translated text.

StreamingTranslateSpeechToSpeech

StreamingTranslateSpeechToSpeechRequest stream

StreamingTranslateSpeechToSpeechResponse stream

Transcribes and translates source audio and streams synthesized speech in the target language.

Scalar Value Types#

.proto Type

Notes

C++

Java

Python

Go

C#

PHP

Ruby

double

double

double

float

float64

double

float

Float

float

float

float

float

float32

float

float

Float

int32

Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.

int32

int

int

int32

int

integer

Bignum or Fixnum (as required)

int64

Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.

int64

long

int/long

int64

long

integer/string

Bignum

uint32

Uses variable-length encoding.

uint32

int

int/long

uint32

uint

integer

Bignum or Fixnum (as required)

uint64

Uses variable-length encoding.

uint64

long

int/long

uint64

ulong

integer/string

Bignum or Fixnum (as required)

sint32

Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.

int32

int

int

int32

int

integer

Bignum or Fixnum (as required)

sint64

Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.

int64

long

int/long

int64

long

integer/string

Bignum

fixed32

Always four bytes. More efficient than uint32 if values are often greater than 2^28.

uint32

int

int

uint32

uint

integer

Bignum or Fixnum (as required)

fixed64

Always eight bytes. More efficient than uint64 if values are often greater than 2^56.

uint64

long

int/long

uint64

ulong

integer/string

Bignum

sfixed32

Always four bytes.

int32

int

int

int32

int

integer

Bignum or Fixnum (as required)

sfixed64

Always eight bytes.

int64

long

int/long

int64

long

integer/string

Bignum

bool

bool

boolean

boolean

bool

bool

boolean

TrueClass/FalseClass

string

A string must always contain UTF-8 encoded or 7-bit ASCII text.

string

String

str/unicode

string

string

string

String (UTF-8)

bytes

Can contain any arbitrary sequence of bytes.

string

ByteString

str

[]byte

ByteString

string

String (ASCII-8BIT)