Skip to content

Language detection

language_config tells the API which language to transcribe:

language_config effect
{}, or languages: [] the language is detected
{"languages": ["fr"]} the session is transcribed in French
{"languages": ["en", "fr"]} the language is detected once, English or French, on the first utterance of three words or more, and kept for the session
{"languages": ["en", "fr"], "code_switching": true} the language is detected utterance by utterance, among English and French
{ "model": "solaria-3", "language_config": { "languages": ["fr"] } }

Every utterance carries its language, and the session’s result lists the languages heard (result.transcription.languages). Until the language is identified, an utterance the model did not tag carries the first language listed (en in an ["en", "fr"] session): on a very short first utterance, that label can be wrong even when the words are right. With no language listed, an utterance the model did not tag carries the language its text is clearly written in (English, French, Spanish, German, Italian, Portuguese or Dutch); otherwise the last language read that way, or en before any.

Setting the language when you know it gives faster and more accurate transcripts than detecting it, especially at the start of a session.

Detection works with solaria-3, and with solaria-1 where your cluster serves it (solaria-1). With several languages listed, the detection is restricted to the listed ones: an utterance is never decoded in a language outside the list.

Without code_switching, the first utterance of three words or more fixes the session’s language, the listed language it was transcribed in: a shorter first utterance (“Okay.”, “Yes.”) fixes nothing, and every utterance after the fixed one is labelled in the session’s language, even one that sounds like another language. solaria-3 and solaria-1 also decode it in that language.

An utterance’s language is always an ISO 639 code (fr, yue), or und when the model names a language no code is known for. It is never a language name.

When the language is detected and the speech is in a language the model does not transcribe (Hebrew on solaria-3, for example), the final utterance says so with "language_supported": false, next to the language heard:

{
"type": "transcript",
"data": {
"id": "00_00004200",
"is_final": true,
"utterance": {
"text": "…",
"start": 3.1,
"end": 4.2,
"language": "he",
"language_supported": false,
"channel": 0,
"words": []
}
}
}

The text of such an utterance is the model’s attempt in a language it was not trained for: often wrong, sometimes written in another script. Read language_supported: false as “pick another model for this language”: check Supported languages, or set the language so a model that does not transcribe it is refused at the start of the session. The field is absent on every other utterance.

A model can also write speech in a language it does not transcribe as text in a language it does: Hebrew may come out as Thai text labelled th, or as English labelled en. The label alone cannot tell. When the deployment turns on the language check (a setting of the inference servers, live and pre-recorded, with spoken language detection in the licence), each utterance’s speech is identified as well, and an utterance heard in a language the model does not transcribe carries that language ("language": "he") and "language_supported": false, whatever the model labelled it. Gotchas:

  • The check runs only when the language is detected (language_config.languages empty); a session or a job that lists or sets its language is never checked.
  • The text is kept as the model wrote it: only language and language_supported change.
  • An utterance shorter than about a second keeps its label: its own speech is too short to be identified apart from the speech before it.
  • A live final is never delayed for the check: a final whose speech is still being identified goes out with its label only.
  • Pre-recorded utterances carry the same language_supported: false, and transcription.languages lists the language heard.

When speakers may use several languages, list them and turn on code switching.

List the languages that may be spoken and leave the session to detect among them (above): the fewer languages listed, the more reliable the detection.