Skip to content

The agent that grows with you

refactor(tools): fold trivial spans, async comprehension in xAI streamer

Tekniumd257aa9335e7
diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py
index a93d28bdc1b..e0292f505c7 100644
--- a/tools/transcription_tools.py
+++ b/tools/transcription_tools.py
@@ -673,9 +673,7 @@ def transcribe_audio(
shutil.rmtree(cleanup_dir, ignore_errors=True)
-def transcribe_audio_local_fallback(
- file_path: str, model: Optional[str] = None
-) -> Dict[str, Any]:
+def transcribe_audio_local_fallback(file_path: str, model: Optional[str] = None) -> Dict[str, Any]:
"""Try an already-installed local STT backend without changing config.
Passive inbound-media recovery after the configured provider failed: never
diff --git a/tools/tts_streaming.py b/tools/tts_streaming.py
index 823e48aec10..a84625048f4 100644
--- a/tools/tts_streaming.py
+++ b/tools/tts_streaming.py
@@ -335,10 +335,7 @@ class XAIStreamer(StreamingTTSProvider):
return asyncio.run(self._drain_async(text))
async def _drain_async(self, text: str) -> List[bytes]:
- frames: List[bytes] = []
- async for frame in self._async_frames(text):
- frames.append(frame)
- return frames
+ return [frame async for frame in self._async_frames(text)]
async def _async_frames(self, text: str):
import json as _json