Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(agent): ensure token stream flushes #167

Merged
merged 2 commits into from
Nov 17, 2024

Conversation

gching
Copy link
Contributor

@gching gching commented Nov 17, 2024

Was noticing the last word for TTS was not being outputted (Websocket, ElevenLabs).
The input stream was not being flushed, and therefore, the remaining token was not being sent upstream.

Changes

  • Ensure BufferedTokenStream ends the input and is flushed before closing
  • Implement missing wrapping methods for BufferedWordStream so the underlying WordStream implementations isn't used

Reproduction

  • Use voice agent pipeline with ElevenLabs
  • Every spoken prompt would be missing the last word

Notes

  • WordStream can probably be converted to an interface since the underlying implementation is technically not needed

Copy link

changeset-bot bot commented Nov 17, 2024

🦋 Changeset detected

Latest commit: f97f239

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-silero Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@nbsp nbsp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a ton! caught this with SentenceStream, didn't think to add it here as well.

@nbsp nbsp changed the title fix(agent) Ensure token stream flushes fix(agent): ensure token stream flushes Nov 17, 2024
@nbsp nbsp merged commit b719e7d into livekit:main Nov 17, 2024
4 checks passed
@nbsp
Copy link
Member

nbsp commented Nov 17, 2024

ack re: WordStream as an interface, might address that in a future PR

@github-actions github-actions bot mentioned this pull request Nov 17, 2024
@gching gching deleted the gching/fix-sythesizing-streams branch November 19, 2024 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants