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
}
| Field | Meaning |
|---|---|
type | Always INPUT. |
messageId | Id of the assistant reply that is about to be produced. The same id is used on the SAY_ and SAY commands of this turn. |
conversationId | Conversation this turn belongs to. |
text | The user message, as received. |
hasFillers | true 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
disableFillersand forceshasFillerstofalse.
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_ is sent for that turn. Wait for the first SAY.
What follows an INPUT
When hasFillers is true, a SAY_ 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:
- On
INPUT, ifhasFillersistrue, enter the waiting state. ASAY_is coming.FILLER - On
SAY_, playFILLER audiowhentextis non-empty. Keep the waiting state whentextis empty. - On the first
SAYof thismessageId, leave the filler and play the reply. - On
INPUTwithhasFillersset tofalse, skip the filler and wait forSAY.
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_ 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.