Overview
TheinterruptPersona()
method allows you to programmatically stop the persona while it’s speaking.
Requires SDK version 3.4.0 or higher
Basic Usage
Stop the persona from speaking immediately:Important Considerations
The
interruptPersona()
method only works while the persona is actively speaking.
Calling it when the persona is not speaking will have no effect but won’t throw an error.interruptPersona()
method behavior:
- Immediately stops any ongoing speech from the persona
- The persona remains ready to receive new input after being interrupted
Use Cases
User-Initiated Interruption
Allow users to interrupt the persona when they want to ask a different question or change topics:Anam’s Voice Activity Detection also automatically interrupts the persona when the user starts speaking. However, you can use this function to interrupt the persona at any time or for a more immediate response.