Clear

Clear will clear out Deepgram's internal text buffer.

What is the 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 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.

Using the Clear Message

Optional

Sending Clear

{
    "type": "Clear"
}

Clear Confirmation

A response will be returned.

{
 
"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.


What’s Next