agents icon indicating copy to clipboard operation
agents copied to clipboard

Missing punctuation when streaming llm text response

Open brentbaum opened this issue 6 months ago • 0 comments

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)
  )
)

brentbaum avatar Aug 06 '24 10:08 brentbaum