Skip to main content

INPUT messages and fillers

When someone sends a message to an application (an avatar, a remote, or any client connected on the app socket), Breign pushes one websocket command of type INPUT. The command carries the user text and tells the client whether a filler will be played before the real reply.

Connect on GET /apps/:appId/sockets, or GET /apps/:appId/instances/:instanceId/sockets when the application has instances.

Payload​

{
"type": "INPUT",
"messageId": "8f2c1a0e-4b7d-4e1a-9c33-1a0b2c3d4e5f",
"conversationId": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"text": "What time does the museum close?",
"hasFillers": true
}
FieldMeaning
typeAlways INPUT.
messageIdId of the assistant reply that is about to be produced. The same id is used on the SAY_FILLER and SAY commands of this turn.
conversationIdConversation this turn belongs to.
textThe user message, as received.
hasFillerstrue when a filler will be sent for this turn, including an empty filler.

INPUT is sent once the conversation exists, on create and on each following message. A request sent with instruction=true does not produce an INPUT.

When hasFillers is true​

Both conditions are required on the application:

  • Streaming is enabled.
  • Fillers are enabled. In the application settings, the Fillers section has an Enable fillers switch. Turning it off sets disableFillers and forces hasFillers to false.

hasFillers stays true when fillers are enabled and no phrase is selected for the conversation language. Breign still sends a filler so the client can enter its waiting state.

hasFillers is false when streaming is off, or when fillers are disabled. No SAY_FILLER is sent for that turn. Wait for the first SAY.

What follows an INPUT​

When hasFillers is true, a SAY_FILLER arrives before the spoken answer. It covers the latency until the first sentence.

{
"type": "SAY_FILLER",
"messageId": "8f2c1a0e-4b7d-4e1a-9c33-1a0b2c3d4e5f",
"conversationId": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"text": "One moment.",
"lang": "en",
"audio": {
"type": "reference",
"src": "https://…",
"id": "filler-voice-en-one-moment"
}
}

Breign picks one checked filler at random among those of the conversation language, synthesizes it with the application voice, and sends the audio. A filler already generated for that voice is reused.

If no phrase is checked for that language, the command still arrives, with an empty text and no audio:

{
"type": "SAY_FILLER",
"messageId": "8f2c1a0e-4b7d-4e1a-9c33-1a0b2c3d4e5f",
"conversationId": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"text": "",
"lang": "en"
}

Play a phrase only when text is non-empty. An empty filler is the signal to hold a waiting pose until the real SAY commands start. Those SAY commands use the same messageId.

Suggested handling:

  1. On INPUT, if hasFillers is true, enter the waiting state. A SAY_FILLER is coming.
  2. On SAY_FILLER, play audio when text is non-empty. Keep the waiting state when text is empty.
  3. On the first SAY of this messageId, leave the filler and play the reply.
  4. On INPUT with hasFillers set to false, skip the filler and wait for SAY.

Conversation language auto​

When the conversation language is auto, Breign guesses the fillers' language from the user's messages, among the languages in which the application has at least one checked filler. A short or ambiguous message ("ok", "42") doesn't decide alone: Breign looks at the user's previous messages, then at the agent's default language. If it still can't tell, lang stays auto. The lang of the SAY_FILLER is the language of the filler actually sent. Nothing changes when the conversation language is fixed (fr, en…).

Sentences of the reply​

With streaming, the reply is sent as one SAY per sentence, as soon as each sentence ends, so the client can start speaking before the whole answer is written. A sentence ends with ., !, ?, … followed by a space, or a line break. In Japanese, where no space follows punctuation, 。, ! and ? end a sentence on their own (closing quotes such as 」 stay with it).

On the stored assistant message​

The same flag is kept on the assistant message of the turn, under hasFillers. You can read it from the conversation (GET /agents/:agentId/conversations/:conversationId) and from the message status once the turn has started. It is true for the whole turn, including after the reply is complete, whenever fillers were enabled. It is absent on messages produced before this field existed.