Skip to content

Commit 56d8774

Browse files
authored
(inworld tts): add new model (#5646)
1 parent 391b5cd commit 56d8774

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

  • livekit-agents/livekit/agents/inference
  • livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld

livekit-agents/livekit/agents/inference/tts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
]
5353
InworldModels = Literal[
5454
"inworld",
55+
"inworld/inworld-tts-2",
5556
"inworld/inworld-tts-1.5-max",
5657
"inworld/inworld-tts-1.5-mini",
5758
"inworld/inworld-tts-1-max",

livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@
1919
"""
2020

2121
from .stt import STT, SpeechStream
22-
from .tts import TTS, ChunkedStream, Encoding, SynthesizeStream, TextNormalization, TimestampType
22+
from .tts import (
23+
TTS,
24+
ChunkedStream,
25+
Encoding,
26+
SynthesizeStream,
27+
TextNormalization,
28+
TimestampType,
29+
TTSModels,
30+
)
2331
from .version import __version__
2432

2533
__all__ = [
@@ -29,6 +37,7 @@
2937
"ChunkedStream",
3038
"SynthesizeStream",
3139
"Encoding",
40+
"TTSModels",
3241
"TextNormalization",
3342
"TimestampType",
3443
"__version__",

livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/tts.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
DEFAULT_MAX_BUFFER_DELAY_MS = 3000
6464
NUM_CHANNELS = 1
6565

66+
TTSModels = Literal["inworld-tts-2", "inworld-tts-1.5-max"]
6667
Encoding = Literal["LINEAR16", "PCM", "MP3", "OGG_OPUS", "FLAC"]
6768
TimestampType = Literal["TIMESTAMP_TYPE_UNSPECIFIED", "WORD", "CHARACTER"]
6869
_TextNormalizationStr = Literal["APPLY_TEXT_NORMALIZATION_UNSPECIFIED", "ON", "OFF"]
@@ -87,7 +88,7 @@ def _resolve_text_normalization(value: Any) -> _TextNormalizationStr:
8788

8889
@dataclass
8990
class _TTSOptions:
90-
model: str
91+
model: TTSModels | str
9192
encoding: Encoding
9293
voice: str
9394
sample_rate: int
@@ -818,7 +819,7 @@ def __init__(
818819
*,
819820
api_key: NotGivenOr[str] = NOT_GIVEN,
820821
voice: NotGivenOr[str] = NOT_GIVEN,
821-
model: NotGivenOr[str] = NOT_GIVEN,
822+
model: NotGivenOr[TTSModels | str] = NOT_GIVEN,
822823
encoding: NotGivenOr[Encoding] = NOT_GIVEN,
823824
bit_rate: NotGivenOr[int] = NOT_GIVEN,
824825
sample_rate: NotGivenOr[int] = NOT_GIVEN,
@@ -976,7 +977,7 @@ def update_options(
976977
self,
977978
*,
978979
voice: NotGivenOr[str] = NOT_GIVEN,
979-
model: NotGivenOr[str] = NOT_GIVEN,
980+
model: NotGivenOr[TTSModels | str] = NOT_GIVEN,
980981
encoding: NotGivenOr[Encoding] = NOT_GIVEN,
981982
bit_rate: NotGivenOr[int] = NOT_GIVEN,
982983
sample_rate: NotGivenOr[int] = NOT_GIVEN,

0 commit comments

Comments
 (0)