Skip to main content
Set language on every request, because Rime does not detect the language. Rime transcribes in the language that you select, so if you send Spanish speech as en, you get a poor transcript, not an error. Two more settings are optional: the mode sets the form of the text, and context terms help the model recognize names. The three settings work the same way in the SDK, the WebSocket API, and both gRPC methods.

Word-for-word mode

The mode tells the model what form of text to write. The quickstart transcribed the same synthesized call in both modes: Word-for-word mode kept “Uh”, “um”, and the spoken “two four seven”. Written mode wrote 247, and on this recording it also left out both fillers. Even so, the mode guides the model but does not guarantee the form of each word. Test the mode on recordings like the ones that your application will get. Phone audio is one such case. When callers read out ZIP codes, phone numbers, or account numbers, use word-for-word mode. In Rime’s tests on phone audio, it kept every digit. Set word-for-word mode in the stream call:
Set mode to TRANSCRIPTION_MODE_VERBATIM in the WebSocket start message, or in the gRPC config or options.TRANSCRIPTION_MODE_WRITTEN is the default. If you omit mode or send TRANSCRIPTION_MODE_UNSPECIFIED, the service uses written mode. An unknown value fails with invalid_input over WebSocket or INVALID_ARGUMENT over gRPC.

Language

Use en for English or es for Spanish, and choose the language from what you already know about the speaker. For example, use the caller’s menu choice or account settings.
The service checks the tag before it accepts audio. Each of these values fails with invalid_input over WebSocket or INVALID_ARGUMENT over gRPC:The SDKs send language without changes, and the service checks it.The direct API returns the confirmed language in started.accepted.language over WebSocket and in accepted.language over gRPC. The final result also has it in language. Its source is always LANGUAGE_SOURCE_SELECTED.

Context terms

Context terms tell the model which names and phrases to expect in this utterance. For example, an agent for flight changes can send the caller’s surname from the booking, such as Okonkwo. The agent can also send its own airline and fare names, such as Northwind Air and FlexPlus. Terms are hints without weights, so they make a match more likely, but they do not force a match. Add the terms to the stream call:
Test terms on your own recordings, and keep the terms that change the result. Terms share the model’s context with the audio, so a long list leaves less space for a long utterance.
  • If you omit the list or send an empty list, the service adds no hints. A term that is empty or has only whitespace fails with invalid_input.
  • The service keeps the order and the text of each term, including spaces and commas in the term. It joins the terms with a comma and a space.
  • The joined list, with its separators, must fit in the limit of 1,024 UTF-8 bytes, not characters. There is no limit on the number of terms.
  • A term cannot contain the control markers of the model, such as text between <| and |>. A term with a control marker fails with invalid_input.
  • The service rejects input that is too large with invalid_input. It never truncates the input.

Field names in the direct APIs

Direct API calls use these fields for the three settings: Each SDK documents its options and their defaults in the rime-sdk repository: Python, Node.js, Go, and Rust.