agents
agents copied to clipboard
Missing punctuation when streaming llm text response
What's the issue?
In the basic VoiceAssistant example, punctuation isn't streamed to the client until tts is complete. This means "Reflection, I hear you would like to talk about cats. I know a lot about cats!" shows up as "Reflection I hear you would like to talk about cats I know a lot about cats" until the whole response is broadcast.
Potential solution
If there isn't a reason for the current behavior, I'd suggest changing the default options for transcription word tokenization to not ignore behavior. I'm getting around this issue right now by passing a transcription
argument to VoiceAssistant
like below:
assistant = VoiceAssistant(
# ... rest of options
transcription=AssistantTranscriptionOptions(
word_tokenizer=WordTokenizer(ignore_punctuation=False)
)
)