Clear
Clear will clear out Deepgram's internal text buffer.
What is the Clear
Message?
Clear
Message?If you're working on a conversational AI use case between a human and a TTS agent, the human may interrupt the Agent at any time, and you may want to clear (or reset) the internal text buffer. This is useful because the TTS websocket will stop sending audio, allowing your LLM to generate a new response. The TTS websocket will then produce audio only based on the new text provided.
After sending the optional Clear
message, the TTS websocket will clear the internal text and audio buffer for generating audio and will stop sending new audio chunks as soon as possible.
Sending Clear
Clear
To send the Clear
message, you need to send the following JSON message to the server:
{
"type": "Clear"
}
Clear
Confirmation
Clear
ConfirmationUpon receiving the Clear
message, the server will process all remaining audio data and return the following:
{
"type": "Cleared",
"sequence_id": 0
}
Conclusion
To ensure seamless interactions between a human and a TTS agent, it's crucial to handle interruptions effectively. Clearing the internal text buffer via a Clear
message allows for fresh input to be sent from the LLM, ensuring the system adapts to the ongoing conversation. This approach stops the generation of unnecessary audio, enhancing the responsiveness and accuracy of the TTS agent.
Updated 3 months ago