diff --git a/.changeset/tall-crews-tickle.md b/.changeset/tall-crews-tickle.md new file mode 100644 index 00000000..365de688 --- /dev/null +++ b/.changeset/tall-crews-tickle.md @@ -0,0 +1,5 @@ +--- +"@livekit/agents-plugin-cartesia": patch +--- + +add updateOptions diff --git a/plugins/cartesia/src/tts.ts b/plugins/cartesia/src/tts.ts index 6979dd47..28c991d7 100644 --- a/plugins/cartesia/src/tts.ts +++ b/plugins/cartesia/src/tts.ts @@ -61,13 +61,15 @@ export class TTS extends tts.TTS { } } - // TODO(nbsp): updateOptions + updateOptions(opts: Partial<TTSOptions>) { + this.#opts = { ...this.#opts, ...opts }; + } synthesize(text: string): tts.ChunkedStream { return new ChunkedStream(this, text, this.#opts); } - stream(): tts.SynthesizeStream { + stream(): SynthesizeStream { return new SynthesizeStream(this, this.#opts); } } @@ -144,6 +146,10 @@ export class SynthesizeStream extends tts.SynthesizeStream { this.#run(); } + updateOptions(opts: Partial<TTSOptions>) { + this.#opts = { ...this.#opts, ...opts }; + } + async #run() { const requestId = randomUUID(); let closing = false;