These days LLM (like GPT) start producing output few characters/words at a time. So although complete response can take 2-5 seconds or more, the partial characters start getting streamed almost in 0.5 sec and keep coming every 0.1 sec.
I would want to use polly to generate speech from the output of LLM. I dont want to wait till end of response, instead, as soon I get few words (say every 5-6 words or I see punctuation), i want to call polly, get the stream, and play this on audio on html.
How can I achieve this?