Skip to content

Realtime: ASR EOU language tags leak into the LLM conversation (unintended reply-language switching) #12748

Open

Description

@nexxtmobile

Bug

ASR backends like Nemotron-3.5 append end-of-utterance language tags to
transcripts ("Hallo. <en-US>", "I would like to cancel my contract. <en-US> Can you help me with that? <de-DE>").

In the realtime pipeline the committed transcript is used verbatim for the
LLM conversation (the user item's Transcript field, which becomes the user
message in the LLM request). The per-utterance tag is unreliable for short
or ambiguous utterances
(a German "Hallo." is tagged <en-US>; the same
uplink clip transcribes as "My name is Benjamin Zimmer. <en-US>" in one
run and "Mein Name ist Benjamin Zimmer. <de-DE>" in another). LLMs treat
the tag as a language signal and switch the reply language against the
session instructions — observed: a German call where the caller says
"Hallo" (tagged <en-US>) gets the reply "Hello. What is your phone number?".

Reproduction

  1. Realtime session with input_audio_transcription on a Nemotron-3.5
    (or similar) backend.
  2. Commit a short ambiguous utterance whose EOU tag does not match the
    conversation language.
  3. The LLM reply switches language (or the reply behavior becomes
    tag-dependent), even though the instruction is to keep the conversation
    language.

Proposed fix

Strip the EOU language tags from the transcript that goes to
appendUserItem/generateResponse (the LLM context). The emitted
input_audio_transcription event keeps the raw transcript (debugging /
client display). PR follows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions