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

playai: create new client only upon exception #1371

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jayeshp19
Copy link
Collaborator

No description provided.

Copy link

changeset-bot bot commented Jan 14, 2025

🦋 Changeset detected

Latest commit: ec8802d

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

This PR includes changesets to release 1 package
Name Type
livekit-plugins-playai 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

@jayeshp19 jayeshp19 changed the title create new client only if exception playai: create new client only if exception Jan 14, 2025
@jayeshp19 jayeshp19 changed the title playai: create new client only if exception playai: create new client only upon exception Jan 14, 2025
@jayeshp19 jayeshp19 marked this pull request as ready for review January 14, 2025 07:51
@@ -162,18 +162,20 @@ def __init__(
self._opts = opts
self._config = self._opts.tts_options
self._mp3_decoder = utils.codecs.Mp3StreamDecoder()
self._client: PlayHTAsyncClient | None = None
Copy link
Member

Choose a reason for hiding this comment

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

should we create it during init as well?something like ensure_client

@@ -194,6 +196,10 @@ async def _run(self) -> None:
)
except Exception as e:
raise APIConnectionError() from e
finally:
if self._client is not None:
Copy link
Member

Choose a reason for hiding this comment

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

this would effectively be the same, no? if the issue is with retries, then we should be resetting only when an exception is caught

btw, should we be closing the client each time? if that creates the websocket, we might end up in the same place.

Copy link
Collaborator Author

@jayeshp19 jayeshp19 Jan 14, 2025

Choose a reason for hiding this comment

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

We might need to change the logic for all TTS streaming providers because we're closing the WebSocket connection in the same way for every request across all providers.

Copy link
Member

Choose a reason for hiding this comment

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

The PipelineAgent is creating a new stream for every synthesis, so this isn't the right fix.
Let's create a thread on Slack?

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.

3 participants