dudleykong
04/01/2025, 5:06 AMVapi Support Bot
04/01/2025, 5:07 AM<flush />
tag only works for the first AI message but not for subsequent messages in your agentic framework. While I couldn't find a definitive solution to make the <flush />
tag work for both AI messages, I can share what I know about this limitation and some potential workarounds.
According to the information I found, the <flush />
tag is indeed used to "force TTS from the AI Messages, otherwise, the entire AI Message has to stream before TTS begins" ([Vapi Documentation](https://docs.vapi.ai/workflows/tasks/say)). However, there appears to be a limitation when using it with multiple AI messages.
Here are some potential approaches to consider:
1. **Try using webhooks instead of the Vapi module**: One user found a workaround by "using the webhook to response then it is correct, rather than using Vapi module" ([Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334661059298066514)). This might help bypass the limitation you're experiencing.
2. **Investigate synchronization issues**: There may be timing issues between message playback and other actions. According to a Discord conversation, "It seems like the timing between the message playback and the transfer action is not synchronized, causing the message to be skipped" ([Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1316539646808686602)). You might need to adjust your call flow logic to ensure proper synchronization.
3. **Check TTS token limits**: There might be token limits affecting how AI messages are processed. Consider "breaking up the LLM output into smaller chunks" ([Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1332287510964994078)) if this is the case.Vapi Support Bot
04/01/2025, 5:07 AM<flush />
tag or other aspects of Vapi's TTS functionality?
Sources:
- [Vapi Documentation](https://docs.vapi.ai/workflows/tasks/say)
- [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334661059298066514)
- [Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1316539646808686602)
- [Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1332287510964994078)
- [Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336989548357353524)Praveen Nair
04/01/2025, 7:56 PMPraveen Nair
04/01/2025, 8:16 PMPraveen Nair
04/01/2025, 8:17 PMPraveen Nair
04/01/2025, 8:17 PMttsBuffer
function processes text. Looking at the implementation:
When a flush tag appears at the beginning of a chunk, there's no content before it to send to TTS (\`sendToTTS\` would be empty). The system might be ignoring these cases or combining multiple chunks before processing flush tags.
By ensuring that flush tags are placed immediately after content to be flushed (without spaces) and within the same output chunk, you'll get more consistent behavior.dudleykong
04/01/2025, 8:32 PM