From d1bd13431f60cc6449d698b92a56e240b5c17bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:17:38 +0200 Subject: [PATCH 1/8] update examples --- .github/update_versions.py | 44 ++++- examples/minimal_worker.py | 13 +- examples/simple-color/agent.py | 2 +- examples/simple-color/requirements.txt | 2 +- examples/speech-to-text/deepgram_stt.py | 14 +- examples/text-to-speech/elevenlabs_tts.py | 9 +- examples/text-to-speech/openai_tts.py | 13 +- .../text-to-speech/sync_tts_transcription.py | 180 +++++++----------- examples/voice-assistant/function_calling.py | 4 +- examples/voice-assistant/minimal_assistant.py | 7 +- .../voice-assistant/simple-rag/assistant.py | 12 +- 11 files changed, 154 insertions(+), 146 deletions(-) diff --git a/.github/update_versions.py b/.github/update_versions.py index efcb25ecf..cedfe2e9c 100644 --- a/.github/update_versions.py +++ b/.github/update_versions.py @@ -1,8 +1,9 @@ import json import pathlib +import re -def update_version(project_root: pathlib.Path, py_version_path: pathlib.Path): +def update_py_version(project_root: pathlib.Path, py_version_path: pathlib.Path) -> str: with open(project_root / "package.json") as f: package = json.load(f) version = package["version"] @@ -17,17 +18,48 @@ def update_version(project_root: pathlib.Path, py_version_path: pathlib.Path): with open(py_version_path, "w") as f: f.writelines(lines) + return version + + +def update_requirements_txt(example_dir: pathlib.Path, last_versions: dict[str, str]): + # recursively find all requirements.txt files + requirements_files = example_dir.rglob("requirements.txt") + + for req_file in requirements_files: + with open(req_file, "r") as f: + lines = f.readlines() + + for i, line in enumerate(lines): + parts = re.split(r"(>=|==|<=|~=|!=|>)", line.strip()) + if len(parts) <= 1: + continue + + pkg_name = parts[0].strip() + if pkg_name in last_versions: + lines[i] = f"{pkg_name}=={last_versions[pkg_name]}\n" + + with open(req_file, "w") as f: + f.writelines(lines) + if __name__ == "__main__": - livekit_agents = pathlib.Path.cwd() / "livekit-agents" - update_version(livekit_agents, livekit_agents / "livekit" / "agents" / "version.py") + package_versions = {} + agents_root = pathlib.Path.cwd() / "livekit-agents" plugins_root = pathlib.Path.cwd() / "livekit-plugins" - plugins = plugins_root.iterdir() - for plugin in plugins: + examples_root = pathlib.Path.cwd() / "examples" + + agent_version = update_py_version(agents_root, agents_root / "livekit" / "agents" / "version.py") + package_versions["livekit-agents"] = agent_version + + for plugin in plugins_root.iterdir(): if not plugin.is_dir(): continue plugin_name = plugin.name.split("-")[-1] py_version_path = plugin / "livekit" / "plugins" / plugin_name / "version.py" - update_version(plugin, py_version_path) + version = update_py_version(plugin, py_version_path) + package_versions[plugin.name] = version + + # update requirements.txt of our examples + update_requirements_txt(examples_root, package_versions) diff --git a/examples/minimal_worker.py b/examples/minimal_worker.py index 29d2e07d4..aeca197cc 100644 --- a/examples/minimal_worker.py +++ b/examples/minimal_worker.py @@ -1,15 +1,18 @@ import logging -from livekit.agents import JobContext, WorkerOptions, cli +from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli + +logger = logging.getLogger("my-worker") +logger.setLevel(logging.INFO) async def entrypoint(ctx: JobContext): - logging.info("starting entrypoint") + logger.info("starting entrypoint") - # Connect to the room - await ctx.connect() + await ctx.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_ALL) - # Add your agent logic here! + logger.info("connected to the room") + # add your agent logic here! if __name__ == "__main__": diff --git a/examples/simple-color/agent.py b/examples/simple-color/agent.py index 50251bce6..e64f5cfda 100644 --- a/examples/simple-color/agent.py +++ b/examples/simple-color/agent.py @@ -30,7 +30,7 @@ async def _draw_color(): frame = rtc.VideoFrame(WIDTH, HEIGHT, rtc.VideoBufferType.RGBA, argb_frame) source.capture_frame(frame) - asyncio.create_task(_draw_color()) + await _draw_color() if __name__ == "__main__": diff --git a/examples/simple-color/requirements.txt b/examples/simple-color/requirements.txt index b885da3d9..ec664c0bb 100644 --- a/examples/simple-color/requirements.txt +++ b/examples/simple-color/requirements.txt @@ -1 +1 @@ -livekit-agents~=0.7.2 +livekit-agents==0.8.0 diff --git a/examples/speech-to-text/deepgram_stt.py b/examples/speech-to-text/deepgram_stt.py index b1a7a3ccb..95f45a402 100644 --- a/examples/speech-to-text/deepgram_stt.py +++ b/examples/speech-to-text/deepgram_stt.py @@ -3,6 +3,7 @@ from livekit import rtc from livekit.agents import ( + AutoSubscribe, JobContext, WorkerOptions, cli, @@ -11,6 +12,9 @@ ) from livekit.plugins import deepgram +logger = logging.getLogger("deepgram-stt-demo") +logger.setLevel(logging.INFO) + async def _forward_transcription( stt_stream: stt.SpeechStream, stt_forwarder: transcription.STTSegmentsForwarder @@ -25,15 +29,15 @@ async def _forward_transcription( print(" -> ", ev.alternatives[0].text) -async def entrypoint(job: JobContext): - logging.info("starting speech-to-text example") +async def entrypoint(ctx: JobContext): + logger.info("starting speech-to-text example") stt = deepgram.STT() tasks = [] async def transcribe_track(participant: rtc.RemoteParticipant, track: rtc.Track): audio_stream = rtc.AudioStream(track) stt_forwarder = transcription.STTSegmentsForwarder( - room=job.room, participant=participant, track=track + room=ctx.room, participant=participant, track=track ) stt_stream = stt.stream() stt_task = asyncio.create_task( @@ -44,9 +48,9 @@ async def transcribe_track(participant: rtc.RemoteParticipant, track: rtc.Track) async for ev in audio_stream: stt_stream.push_frame(ev.frame) - await job.connect(auto_subscribe="audio_only") + await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY) - @job.room.on("track_subscribed") + @ctx.room.on("track_subscribed") def on_track_subscribed( track: rtc.Track, publication: rtc.TrackPublication, diff --git a/examples/text-to-speech/elevenlabs_tts.py b/examples/text-to-speech/elevenlabs_tts.py index 375389be1..7f6180402 100644 --- a/examples/text-to-speech/elevenlabs_tts.py +++ b/examples/text-to-speech/elevenlabs_tts.py @@ -6,6 +6,9 @@ from livekit.agents import JobContext, WorkerOptions, cli from livekit.plugins import elevenlabs +logger = logging.getLogger("elevenlabs-tts-demo") +logger.setLevel(logging.INFO) + def _text_to_chunks(text: str) -> list[str]: """Split the text into chunks of 2, 3, and 4 words""" @@ -51,12 +54,12 @@ async def entrypoint(job: JobContext): await job.room.local_participant.publish_track(track, options) await asyncio.sleep(1) - logging.info('Saying "Bonjour, comment allez-vous?"') + logger.info('Saying "Bonjour, comment allez-vous?"') async for output in tts_11labs.synthesize("Bonjour, comment allez-vous?"): await source.capture_frame(output.frame) await asyncio.sleep(1) - logging.info('Saying "Au revoir."') + logger.info('Saying "Au revoir."') async for output in tts_11labs.synthesize("Au revoir."): await source.capture_frame(output.frame) @@ -64,7 +67,7 @@ async def entrypoint(job: JobContext): streamed_text = ( "Bonjour, ceci est un autre example avec la méthode utilisant un websocket." ) - logging.info('Streaming text "%s"', streamed_text) + logger.info('Streaming text "%s"', streamed_text) stream = tts_11labs.stream() for chunk in _text_to_chunks( streamed_text diff --git a/examples/text-to-speech/openai_tts.py b/examples/text-to-speech/openai_tts.py index d65c8b4dc..0edcb3b7c 100644 --- a/examples/text-to-speech/openai_tts.py +++ b/examples/text-to-speech/openai_tts.py @@ -2,12 +2,15 @@ import logging from livekit import rtc -from livekit.agents import JobContext, WorkerOptions, cli +from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli from livekit.plugins import openai +logger = logging.getLogger("openai-tts-demo") +logger.setLevel(logging.INFO) + async def entrypoint(job: JobContext): - logging.info("starting tts example agent") + logger.info("starting tts example agent") tts = openai.TTS(model="tts-1", voice="nova") @@ -16,16 +19,16 @@ async def entrypoint(job: JobContext): options = rtc.TrackPublishOptions() options.source = rtc.TrackSource.SOURCE_MICROPHONE - await job.connect() + await job.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_NONE) await job.room.local_participant.publish_track(track, options) await asyncio.sleep(1) - logging.info('Saying "Hello!"') + logger.info('Saying "Hello!"') async for output in tts.synthesize("Hello!"): await source.capture_frame(output.frame) await asyncio.sleep(1) - logging.info('Saying "Goodbye."') + logger.info('Saying "Goodbye."') async for output in tts.synthesize("Goodbye."): await source.capture_frame(output.frame) diff --git a/examples/text-to-speech/sync_tts_transcription.py b/examples/text-to-speech/sync_tts_transcription.py index 0c54181ef..f3f08ff6c 100644 --- a/examples/text-to-speech/sync_tts_transcription.py +++ b/examples/text-to-speech/sync_tts_transcription.py @@ -4,6 +4,7 @@ from livekit import rtc from livekit.agents import ( + AutoSubscribe, JobContext, WorkerOptions, cli, @@ -12,96 +13,48 @@ ) from livekit.plugins import elevenlabs +logger = logging.getLogger("transcription-forwarding-demo") +logger.setLevel(logging.INFO) -def _text_to_chunks(text: str) -> list[str]: - """Split the text into chunks of 2, 3, and 4 words""" - sizes = [2, 3, 4] - chunks, i = [], 0 - - for size in sizes: - while i + size <= len(text): - chunks.append(text[i : i + size]) - i += size - chunks.append(text[i:]) # remaining - return chunks - - -async def _playout_task( - playout_q: asyncio.Queue, audio_source: rtc.AudioSource -) -> None: - """Playout audio frames from the queue to the audio source""" - while True: - frame = await playout_q.get() - if frame is None: - break - - await audio_source.capture_frame(frame) +async def entrypoint(ctx: JobContext): + logger.info("starting transcription protocol example") + tts_11labs = elevenlabs.TTS() + # publish an audio track + source = rtc.AudioSource(tts_11labs.sample_rate, tts_11labs.num_channels) + track = rtc.LocalAudioTrack.create_audio_track("agent-mic", source) + options = rtc.TrackPublishOptions(source=rtc.TrackSource.SOURCE_MICROPHONE) -async def _eg_streamed_tts_stream( - ctx: JobContext, tts_11labs: tts.TTS, source: rtc.AudioSource -): - """Transcription example using a tts stream (we split text into chunks just for the example)""" + await ctx.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_NONE) + await ctx.room.local_participant.publish_track(track, options) - # this tts_forwarder will forward the transcription to the client and sync with the audio + # start the transcription examples tts_forwarder = transcription.TTSSegmentsForwarder( room=ctx.room, participant=ctx.room.local_participant ) - tts_stream = tts_11labs.stream() - - streamed_text = "Hello world, this text is going to be splitted into small chunks" - logging.info("pushing text %s", streamed_text) - for chunk in _text_to_chunks(streamed_text): - tts_stream.push_text(chunk) - tts_forwarder.push_text(chunk) - - tts_stream.flush() - tts_forwarder.mark_text_segment_end() - - second_streamed_text = "This is another segment that will be streamed" - logging.info("pushing text %s", second_streamed_text) - for chunk in _text_to_chunks(second_streamed_text): - tts_stream.push_text(chunk) - tts_forwarder.push_text(chunk) - - tts_stream.flush() - tts_stream.end_input() - tts_forwarder.mark_text_segment_end() - - playout_q = asyncio.Queue[Optional[rtc.AudioFrame]]() - - async def _synth_task(): - async for ev in tts_stream: - playout_q.put_nowait(ev.frame) - - playout_q.put_nowait(None) - - synth_task = asyncio.create_task(_synth_task()) - playout_task = asyncio.create_task(_playout_task(playout_q, source)) + await asyncio.sleep(2) + await _eg_single_segment(tts_forwarder, tts_11labs, source) - await asyncio.gather(synth_task, playout_task) - await tts_stream.aclose() - await tts_forwarder.aclose() + await asyncio.sleep(2) + await _eg_streamed_tts_stream(tts_forwarder, tts_11labs, source) async def _eg_single_segment( - ctx: JobContext, tts_11labs: tts.TTS, source: rtc.AudioSource + tts_forwarder: transcription.TTSSegmentsForwarder, + tts_11labs: tts.TTS, + source: rtc.AudioSource, ): - """Transcription example without streaming (single segment""" - - tts_forwarder = transcription.TTSSegmentsForwarder( - room=ctx.room, participant=ctx.room.local_participant - ) + """Transcription example without streaming (single string)""" text = "Hello world, this is a single segment" - logging.info("pushing text %s", text) + logger.info("pushing text %s", text) tts_forwarder.push_text(text) tts_forwarder.mark_text_segment_end() playout_q = asyncio.Queue[Optional[rtc.AudioFrame]]() - playout_task = asyncio.create_task(_playout_task(playout_q, source)) + playout_task = asyncio.create_task(_playout_task(tts_forwarder, playout_q, source)) async for output in tts_11labs.synthesize(text): tts_forwarder.push_audio(output.frame) @@ -110,63 +63,76 @@ async def _eg_single_segment( tts_forwarder.mark_audio_segment_end() playout_q.put_nowait(None) - await tts_forwarder.aclose() await playout_task -async def _eg_deferred_playout( - ctx: JobContext, tts_11labs: tts.TTS, source: rtc.AudioSource +async def _eg_streamed_tts_stream( + tts_forwarder: transcription.TTSSegmentsForwarder, + tts_11labs: tts.TTS, + source: rtc.AudioSource, ): - """example with deferred playout (We have a synthesized audio before starting to play it)""" - tts_forwarder = transcription.TTSSegmentsForwarder( - room=ctx.room, participant=ctx.room.local_participant - ) + """Transcription example using a tts stream (we split text into chunks just for the example)""" - text = "Hello world, this is a single segment with deferred playout" - logging.info("pushing text %s", text) - tts_forwarder.push_text(text) + # this tts_forwarder will forward the transcription to the client and sync with the audio + tts_stream = tts_11labs.stream() + + streamed_text = "Hello world, this text is going to be splitted into small chunks" + logger.info("pushing text %s", streamed_text) + for chunk in _text_to_chunks(streamed_text): + tts_stream.push_text(chunk) + tts_forwarder.push_text(chunk) + + tts_stream.flush() tts_forwarder.mark_text_segment_end() playout_q = asyncio.Queue[Optional[rtc.AudioFrame]]() - async for output in tts_11labs.synthesize(text): - tts_forwarder.push_audio(output.frame) - playout_q.put_nowait(output.frame) + async def _synth_task() -> None: + async for ev in tts_stream: + playout_q.put_nowait(ev.frame) + tts_forwarder.push_audio(ev.frame) - tts_forwarder.mark_audio_segment_end() + tts_forwarder.mark_audio_segment_end() + playout_q.put_nowait(None) + await tts_stream.aclose() - logging.info("waiting 2 seconds before starting playout") - await asyncio.sleep(2) + playout_task = asyncio.create_task(_playout_task(tts_forwarder, playout_q, source)) + synth_task = asyncio.create_task(_synth_task()) - tts_forwarder.segment_playout_started() - playout_task = asyncio.create_task(_playout_task(playout_q, source)) + await asyncio.gather(synth_task, playout_task) - playout_q.put_nowait(None) - tts_forwarder.segment_playout_finished() - await playout_task await tts_forwarder.aclose() -async def entrypoint(ctx: JobContext): - logging.info("starting transcription protocol example") +async def _playout_task( + tts_forwarder: transcription.TTSSegmentsForwarder, + playout_q: asyncio.Queue, + audio_source: rtc.AudioSource, +) -> None: + """Playout audio frames from the queue to the audio source""" + tts_forwarder.segment_playout_started() + while True: + frame = await playout_q.get() + if frame is None: + break - tts_11labs = elevenlabs.TTS() + await audio_source.capture_frame(frame) - # publish an audio track - source = rtc.AudioSource(tts_11labs.sample_rate, tts_11labs.num_channels) - track = rtc.LocalAudioTrack.create_audio_track("agent-mic", source) - options = rtc.TrackPublishOptions(source=rtc.TrackSource.SOURCE_MICROPHONE) + tts_forwarder.segment_playout_finished() - await ctx.connect() - await ctx.room.local_participant.publish_track(track, options) - # start the transcription examples - await asyncio.sleep(2) - await _eg_streamed_tts_stream(ctx, tts_11labs, source) - await asyncio.sleep(2) - await _eg_single_segment(ctx, tts_11labs, source) - await asyncio.sleep(2) - await _eg_deferred_playout(ctx, tts_11labs, source) +def _text_to_chunks(text: str) -> list[str]: + """Split the text into chunks of 2, 3, and 4 words""" + sizes = [2, 3, 4] + chunks, i = [], 0 + + for size in sizes: + while i + size <= len(text): + chunks.append(text[i : i + size]) + i += size + + chunks.append(text[i:]) # remaining + return chunks if __name__ == "__main__": diff --git a/examples/voice-assistant/function_calling.py b/examples/voice-assistant/function_calling.py index 44be89190..19425cd7a 100644 --- a/examples/voice-assistant/function_calling.py +++ b/examples/voice-assistant/function_calling.py @@ -3,7 +3,7 @@ import logging from typing import Annotated -from livekit.agents import JobContext, WorkerOptions, cli, llm +from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli, llm from livekit.agents.voice_assistant import VoiceAssistant from livekit.plugins import deepgram, openai, silero @@ -98,7 +98,7 @@ async def _will_synthesize_assistant_reply( will_synthesize_assistant_reply=_will_synthesize_assistant_reply, ) - await ctx.connect() + await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY) # Start the assistant. This will automatically publish a microphone track and listen to the first participant # it finds in the current room. If you need to specify a particular participant, use the participant parameter. diff --git a/examples/voice-assistant/minimal_assistant.py b/examples/voice-assistant/minimal_assistant.py index d40060b47..0ebcfc71e 100644 --- a/examples/voice-assistant/minimal_assistant.py +++ b/examples/voice-assistant/minimal_assistant.py @@ -1,13 +1,12 @@ import asyncio -from livekit.agents import JobContext, WorkerOptions, cli -from livekit.agents.llm import ChatContext +from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli, llm from livekit.agents.voice_assistant import VoiceAssistant from livekit.plugins import deepgram, elevenlabs, openai, silero async def entrypoint(ctx: JobContext): - initial_ctx = ChatContext().append( + initial_ctx = llm.ChatContext().append( role="system", text=( "You are a voice assistant created by LiveKit. Your interface with users will be voice. " @@ -15,7 +14,7 @@ async def entrypoint(ctx: JobContext): ), ) - await ctx.connect() + await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY) assistant = VoiceAssistant( vad=silero.VAD.load(), diff --git a/examples/voice-assistant/simple-rag/assistant.py b/examples/voice-assistant/simple-rag/assistant.py index a4af3ba5f..84d9aa6ae 100644 --- a/examples/voice-assistant/simple-rag/assistant.py +++ b/examples/voice-assistant/simple-rag/assistant.py @@ -1,7 +1,7 @@ import asyncio import pickle -from livekit.agents import JobContext, WorkerOptions, cli, llm +from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli, llm from livekit.agents.voice_assistant import VoiceAssistant from livekit.plugins import deepgram, openai, rag, silero @@ -24,13 +24,10 @@ async def _will_synthesize_assistant_answer( ) result = annoy_index.query(user_embedding[0].embedding, n=1)[0] - - print(result.distance) paragraph = paragraphs_by_uuid[result.userdata] user_msg.content = ( "Context:\n" + paragraph + "\n\nUser question: " + user_msg.content ) - print(user_msg) return assistant.llm.chat(chat_ctx=chat_ctx, fnc_ctx=assistant.fnc_ctx) initial_ctx = llm.ChatContext().append( @@ -38,20 +35,21 @@ async def _will_synthesize_assistant_answer( text=( "You are a voice assistant created by LiveKit. Your interface with users will be voice. " "You should use short and concise responses, and avoiding usage of unpronouncable punctuation." + "Use the provided context to answer the user's question if needed." ), ) + await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY) + assistant = VoiceAssistant( chat_ctx=initial_ctx, - vad=silero.VAD(), + vad=silero.VAD.load(), stt=deepgram.STT(), llm=openai.LLM(), tts=openai.TTS(), will_synthesize_assistant_reply=_will_synthesize_assistant_answer, - plotting=True, ) - await ctx.connect() assistant.start(ctx.room) await asyncio.sleep(1) From 541f5621ea696f82682d42a82f4c10e8e0422463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:18:09 +0200 Subject: [PATCH 2/8] Update update_versions.py --- .github/update_versions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/update_versions.py b/.github/update_versions.py index cedfe2e9c..a2800a2d2 100644 --- a/.github/update_versions.py +++ b/.github/update_versions.py @@ -49,7 +49,9 @@ def update_requirements_txt(example_dir: pathlib.Path, last_versions: dict[str, plugins_root = pathlib.Path.cwd() / "livekit-plugins" examples_root = pathlib.Path.cwd() / "examples" - agent_version = update_py_version(agents_root, agents_root / "livekit" / "agents" / "version.py") + agent_version = update_py_version( + agents_root, agents_root / "livekit" / "agents" / "version.py" + ) package_versions["livekit-agents"] = agent_version for plugin in plugins_root.iterdir(): From e982852a59ce63554f0fb0147b42258ac586ec00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:18:39 +0200 Subject: [PATCH 3/8] export AutoSubscribe --- livekit-agents/livekit/agents/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/livekit-agents/livekit/agents/__init__.py b/livekit-agents/livekit/agents/__init__.py index 0578d9356..c3c168541 100644 --- a/livekit-agents/livekit/agents/__init__.py +++ b/livekit-agents/livekit/agents/__init__.py @@ -13,7 +13,7 @@ # limitations under the License. from . import ipc, llm, stt, tokenize, transcription, tts, utils, vad, voice_assistant -from .job import JobContext, JobProcess, JobRequest +from .job import AutoSubscribe, JobContext, JobProcess, JobRequest from .plugin import Plugin from .version import __version__ from .worker import Worker, WorkerOptions @@ -25,6 +25,7 @@ "JobProcess", "JobContext", "JobRequest", + "AutoSubscribe", "Plugin", "ipc", "stt", From 019a724b0f018b5ba11daae3ef133deef1c050e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Sat, 27 Jul 2024 00:19:00 +0200 Subject: [PATCH 4/8] Create gentle-numbers-happen.md --- .changeset/gentle-numbers-happen.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/gentle-numbers-happen.md diff --git a/.changeset/gentle-numbers-happen.md b/.changeset/gentle-numbers-happen.md new file mode 100644 index 000000000..109d140b9 --- /dev/null +++ b/.changeset/gentle-numbers-happen.md @@ -0,0 +1,5 @@ +--- +"livekit-agents": patch +--- + +update examples to the latest API & export AutoSubscribe From a51ecc3691f86d5f6063cc69af4cf1363a84a72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:22:31 +0200 Subject: [PATCH 5/8] nit --- .github/update_versions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/update_versions.py b/.github/update_versions.py index a2800a2d2..5333b60f1 100644 --- a/.github/update_versions.py +++ b/.github/update_versions.py @@ -59,8 +59,9 @@ def update_requirements_txt(example_dir: pathlib.Path, last_versions: dict[str, continue plugin_name = plugin.name.split("-")[-1] - py_version_path = plugin / "livekit" / "plugins" / plugin_name / "version.py" - version = update_py_version(plugin, py_version_path) + version = update_py_version( + plugin, plugin / "livekit" / "plugins" / plugin_name / "version.py" + ) package_versions[plugin.name] = version # update requirements.txt of our examples From e9bcf016291981588ac53b342b971fb2480f3ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:23:41 +0200 Subject: [PATCH 6/8] revert --- examples/simple-color/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simple-color/requirements.txt b/examples/simple-color/requirements.txt index ec664c0bb..f66870d19 100644 --- a/examples/simple-color/requirements.txt +++ b/examples/simple-color/requirements.txt @@ -1 +1 @@ -livekit-agents==0.8.0 +livekit-agents~=0.7.2 \ No newline at end of file From ad4b8eddc84d017c3de74e0126a9d7227b433eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:24:35 +0200 Subject: [PATCH 7/8] Update update_versions.py --- .github/update_versions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/update_versions.py b/.github/update_versions.py index 5333b60f1..e83752da7 100644 --- a/.github/update_versions.py +++ b/.github/update_versions.py @@ -36,7 +36,7 @@ def update_requirements_txt(example_dir: pathlib.Path, last_versions: dict[str, pkg_name = parts[0].strip() if pkg_name in last_versions: - lines[i] = f"{pkg_name}=={last_versions[pkg_name]}\n" + lines[i] = f"{pkg_name}>={last_versions[pkg_name]}\n" with open(req_file, "w") as f: f.writelines(lines) From df0629912443c9913edf82e5227e2a57d9eb856a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Sat, 27 Jul 2024 00:25:15 +0200 Subject: [PATCH 8/8] Update requirements.txt --- examples/simple-color/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simple-color/requirements.txt b/examples/simple-color/requirements.txt index f66870d19..b885da3d9 100644 --- a/examples/simple-color/requirements.txt +++ b/examples/simple-color/requirements.txt @@ -1 +1 @@ -livekit-agents~=0.7.2 \ No newline at end of file +livekit-agents~=0.7.2