MCPcopy Create free account
hub / github.com/livekit/agents / _stream_task

Function _stream_task

tests/test_tts_fallback.py:98–114  ·  view source on GitHub ↗
(text: str, audio_duration: float)

Source from the content-addressed store, hash-verified

96 stream.end_input()
97
98 async def _stream_task(text: str, audio_duration: float) -> None:
99 fake1.update_options(fake_timeout=0.5, fake_audio_duration=audio_duration)
100
101 async with fallback_adapter.stream() as stream:
102 input_task = asyncio.create_task(_input_task(stream, text))
103
104 segments = set()
105 try:
106 async for ev in stream:
107 segments.add(ev.segment_id)
108 finally:
109 await input_task
110
111 if audio_duration > 0.0:
112 assert len(segments) == 1
113 else:
114 assert len(segments) == 0
115
116 await _stream_task("hello test normal", 1.0)
117

Callers 1

test_no_audioFunction · 0.85

Calls 5

_input_taskFunction · 0.85
create_taskMethod · 0.80
update_optionsMethod · 0.45
streamMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected