Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshp19 committed Dec 25, 2024
1 parent 47818f1 commit 94ac7e8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion livekit-agents/livekit/agents/tts/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def synthesize(
text: str,
*,
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
segment_id: str = "",
segment_id: str | None = None,
) -> ChunkedStream: ...

def stream(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def synthesize(
text: str,
*,
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
segment_id: str = "",
segment_id: str | None = None,
) -> "ChunkedStream":
return ChunkedStream(
tts=self,
Expand All @@ -222,7 +222,7 @@ def __init__(
input_text: str,
conn_options: APIConnectOptions,
opts: _TTSOptions,
segment_id: str = "",
segment_id: str | None = None,
) -> None:
super().__init__(tts=tts, input_text=input_text, conn_options=conn_options)
self._opts = opts
Expand Down Expand Up @@ -296,14 +296,14 @@ def __init__(
opts: _TTSOptions,
loop: asyncio.AbstractEventLoop,
event_ch: utils.aio.ChanSender[tts.SynthesizedAudio],
segment_id: str,
segment_id: str | None = None,
):
super().__init__()
self._event_ch = event_ch
self._opts = opts
self._loop = loop
self._request_id = utils.shortuuid()
self._segment_id = segment_id
self._segment_id = segment_id or utils.shortuuid()

self._bstream = utils.audio.AudioByteStream(
sample_rate=opts.sample_rate, num_channels=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def synthesize(
text: str,
*,
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
segment_id: str = "",
segment_id: str | None = None,
) -> "ChunkedStream":
return ChunkedStream(
tts=self,
Expand All @@ -182,11 +182,11 @@ def __init__(
conn_options: APIConnectOptions,
opts: _TTSOptions,
client: texttospeech.TextToSpeechAsyncClient,
segment_id: str = "",
segment_id: str | None = None,
) -> None:
super().__init__(tts=tts, input_text=input_text, conn_options=conn_options)
self._opts, self._client = opts, client
self._segment_id = segment_id
self._segment_id = segment_id or utils.shortuuid()

async def _run(self) -> None:
request_id = utils.shortuuid()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def synthesize(
text: str,
*,
conn_options: APIConnectOptions = DEFAULT_API_CONNECT_OPTIONS,
segment_id: str = "",
segment_id: str | None = None,
) -> "ChunkedStream":
return ChunkedStream(
tts=self,
Expand All @@ -164,12 +164,12 @@ def __init__(
conn_options: APIConnectOptions,
opts: _TTSOptions,
client: openai.AsyncClient,
segment_id: str = "",
segment_id: str | None = None,
) -> None:
super().__init__(tts=tts, input_text=input_text, conn_options=conn_options)
self._client = client
self._opts = opts
self._segment_id = segment_id
self._segment_id = segment_id or utils.shortuuid()

async def _run(self):
oai_stream = self._client.audio.speech.with_streaming_response.create(
Expand Down

0 comments on commit 94ac7e8

Please sign in to comment.