Automation foundation model for tiny devices: 2-bit, 8-29 MB, tool calls, ASR, structured extraction and embeddings on phones, wearables, smart homes, robots, cars and microcontrollers.
Whistle streaming (#168)
Jakub Mroz4b28de73c0b7
diff --git a/README.md b/README.mdindex 1ae78af..254d730 100644--- a/README.md+++ b/README.md@@ -57,7 +57,7 @@ print(needle.transcribe("clip.wav")["text"])# turn off the kitchen lights```-Every call returns the text, the language, the milliseconds to the first token and the decoder's tokens per second after it. `word_timestamps=True` adds each word with its start, end and probability, `keywords=[...]` favours the names and product words your users say, and `language="de"` forces the language instead of detecting it. `needle.Whistle()` is the same model as an object, for `embed(audio)` or to hold one tuned `.cact`. Silence and steady noise return an empty transcript rather than an invented sentence. `needle whistle playground` transcribes from the microphone, and `needle whistle compare` puts Whistle next to Whisper and Moonshine on the same clip.+Every call returns the text, the language, the milliseconds to the first token and the decoder's tokens per second after it. `word_timestamps=True` adds each word with its start, end and probability, `keywords=[...]` favours the names and product words your users say, and `language="de"` forces the language instead of detecting it. `needle.Whistle()` is the same model as an object, for `embed(audio)` or to hold one tuned `.cact`. Silence and steady noise return an empty transcript rather than an invented sentence. `needle.stream(chunks)` transcribes live for as long as the microphone runs, committing the words two passes agree on. `needle whistle playground` transcribes from the microphone, and `needle whistle compare` puts Whistle next to Whisper and Moonshine on the same clip.At 16.9 MB Whistle is 8.6x smaller than Whisper base and 6.6x quicker to the first token. It is ahead on LibriSpeech test-clean and test-other, on SPGISpeech, on Earnings-22 and on the FLEURS average. Whisper base is ahead on TED-LIUM, on AMI and on the MLS average.diff --git a/llms.txt b/llms.txtindex 2ad06d9..6ac4b0e 100644--- a/llms.txt+++ b/llms.txt@@ -27,7 +27,8 @@ pip install "cactus-needle[train]" # adds JAX + training deps for finetune- `needle.Field(default=..., *, description, enum, const, ge, le, gt, lt, multiple_of, min_length, max_length, pattern, format, min_items, max_items, unique_items)` - per-argument constraints; attach inline with `typing.Annotated`.- `needle.extract(text, schema, system=None, max_new_tokens=512, weights=None)` - one-shot extraction; returns a Pydantic instance if `schema` is a model, else a dict (or `None` if nothing matched). `weights` selects a tuned `.cact` and defaults to whatever the engine already has loaded, so extraction inherits the active tuned model unless you pass another path.- `needle.transcribe(audio, language=None, keywords=None, word_timestamps=False, weights=None) -> dict` - speech to text in English, German, French, Spanish, Italian, Dutch and Polish, on the same engine and the same install as Needle. `audio` is a WAV path or 16 kHz mono float samples in [-1, 1], at most 30 s. Returns `{"text", "language", "ttft_ms", "decode_tps"}`, plus `"words"` with `start`, `end` and `probability` when `word_timestamps` is set. `language` is one of `en de fr es it nl pl`, or `None` to detect it; `keywords` is a list or a newline-separated string of words and phrases to favour. Silence and steady noise return an empty text and language. 16 kHz WAV files and raw samples need nothing extra; other sample rates need the `[mic]` extra for soxr. `whistle.cact` is fetched from `Cactus-Compute/whistle` on first use.-- `needle.Whistle(weights=None, buffer_size=262144)` - the same model as an object, for `whistle.embed(audio)` (the encoder output, one row of floats per 80 ms frame, flattened) or to hold one tuned `.cact`. One model per process, not thread-safe.+- `needle.stream(chunks, language=None, keywords=None, weights=None)` - live transcription with no limit on length. `chunks` is an iterable of 16 kHz mono float sample buffers, about a second each; the generator yields one dict per chunk with the `"text"` and `"words"` committed by it (times from the start of the stream), the unconfirmed `"pending"` tail, the `"language"`, the seconds `"received"` and `"pass_ms"`, then one more for the tail when the chunks end. Join the texts with a space. Every chunk re-transcribes the last seconds and commits what two passes agree on.+- `needle.Whistle(weights=None, buffer_size=262144)` - the same model as an object, for `whistle.transcribe(...)`, `whistle.stream(...)`, `whistle.embed(audio)` (the encoder output, one row of floats per 80 ms frame, flattened) or to hold one tuned `.cact`. One model per process, not thread-safe.## Defining tools (three equivalent ways)@@ -236,7 +237,7 @@ Adapt by swapping the Literal values for your own and keeping the shapes: closed- `needle run --checkpoint <base.safetensors> --query "..." --tools tools.json` - JAX reference inference from a checkpoint (dev path; normal inference is the Python `Needle` API above).- `needle generate-data` / `needle finetune` / `needle build [checkpoint] [--lora adapter] [--layers N] [--platform <folder>] [--out <path>]` - the fine-tuning pipeline; fine-tuning runs at the full 20 layers, `build` merges the adapter, slices the `--layers` rung (default 20), exports at 4 bits, and fetches the published `needle3.cact` on every run (without an adapter at full depth it ships that published 2-bit archive as is). `--platform` also downloads that platform's engine and header and makes `--out` a folder holding them plus `needle3.cact`.- `needle playground` - the browser UI locally (hosted at https://cactuscompute.com/needle).-- `needle whistle playground [clip.wav] [--language en] [--keywords "Siobhan, Krzysztof"] [--word-timestamps] [--weights whistle.cact]` - Whistle speech to text in the terminal: press Enter to speak, Enter again to stop, or pass a WAV file; `/language`, `/keywords`, `/timestamps` and `/file` change the settings between recordings. Recording from the microphone needs the `[mic]` extra. `whistle.cact` is fetched from `Cactus-Compute/whistle` on first use and runs on the same engine as Needle; `NEEDLE_WHISTLE_WEIGHTS` points at a local copy and `NEEDLE3_LIB_PATH` at a local engine.+- `needle whistle playground [clip.wav] [--language en] [--keywords "Siobhan, Krzysztof"] [--word-timestamps] [--weights whistle.cact]` - Whistle speech to text in the terminal: press Enter to speak, Enter again to stop, or pass a WAV file; `/language`, `/keywords`, `/timestamps` and `/file` change the settings between recordings, and `/stream` switches to live transcription, the words printing as they are committed. Recording from the microphone needs the `[mic]` extra. `whistle.cact` is fetched from `Cactus-Compute/whistle` on first use and runs on the same engine as Needle; `NEEDLE_WHISTLE_WEIGHTS` points at a local copy and `NEEDLE3_LIB_PATH` at a local engine.- `needle whistle compare [clip.wav] [--weights whistle.cact]` - the same English speech through Whistle, Whisper tiny and base (openai-whisper) and Moonshine tiny v2 (moonshine-voice), one line per model with its weight size, time to first token, decode tokens per second, total time and transcript; `/file` runs a WAV between recordings. Whistle's timing comes from the engine's own JSON. Needs the `[mic,compare]` extras.- `needle download whistle [--out <dir>]` - pre-download the `whistle.cact` speech weights. There is one engine for both models, so `needle fetch` and `needle download <platform>` cover the library and the platform folders.- `needle fetch [--platform-tag <tag>] [--out <dir>]` - pre-download the inference engine for this machine (or another platform) into the cache; prints the path. For air-gapped devices, also see `NEEDLE3_LIB_PATH` and `HF_HUB_OFFLINE` at https://cactuscompute.com/blog/needle-python-docs.diff --git a/needle/__init__.py b/needle/__init__.pyindex e838d39..133ff10 100644--- a/needle/__init__.py+++ b/needle/__init__.py@@ -11,11 +11,11 @@ import warningsfrom .agent.tools import Field, build_schema, pydantic_schema, tool, _is_pydantic_modelfrom ._telemetry import track as _trackfrom ._worker import FineTuneWorker-from .agent.whistle import Whistle, transcribe+from .agent.whistle import Whistle, stream, transcribe__version__ = "3.1.0"__all__ = ["Needle", "Whistle", "ExtractionValidationError", "tool", "Field", "extract",- "transcribe", "__version__"]+ "transcribe", "stream", "__version__"]class ExtractionValidationError(ValueError):diff --git a/needle/agent/whistle.py b/needle/agent/whistle.pyindex 9f854dc..109d883 100644--- a/needle/agent/whistle.py+++ b/needle/agent/whistle.py@@ -4,7 +4,10 @@ import arrayimport ctypesimport jsonimport os+import queue+import shutilimport sys+import threadingimport timeimport wave@@ -34,6 +37,11 @@ def _lib():lib.needle_transcribe.argtypes = [samples, ctypes.c_int, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int,ctypes.c_char_p, ctypes.c_int]lib.needle_transcribe.restype = ctypes.c_int+ lib.needle_stream_transcribe_process.argtypes = [samples, ctypes.c_int, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p,+ ctypes.c_int]+ lib.needle_stream_transcribe_process.restype = ctypes.c_int+ lib.needle_stream_transcribe_stop.argtypes = [ctypes.c_char_p, ctypes.c_int]+ lib.needle_stream_transcribe_stop.restype = ctypes.c_intlib.needle_embed.argtypes = [ctypes.c_char_p, samples, ctypes.c_int, samples, ctypes.c_int]lib.needle_embed.restype = ctypes.c_intlib.needle_last_error.argtypes = []@@ -66,6 +74,12 @@ def _read_wav(path):return soxr.resample(numpy.asarray(mono, numpy.float32), rate, SAMPLE_RATE, quality="HQ")+def _options(language, keywords):+ if keywords is not None and not isinstance(keywords, str):+ keywords = "\n".join(keywords)+ return language.encode("utf-8") if language else None, keywords.encode("utf-8") if keywords else None++def _samples(audio):if isinstance(audio, (str, os.PathLike)):audio = _read_wav(os.fspath(audio))@@ -106,6 +120,11 @@ class Whistle:_loaded = self.weightsreturn lib+ def _result(self, code):+ if code < 0:+ raise RuntimeError(_lib().needle_last_error().decode("utf-8", "replace"))+ return json.loads(self._buffer.value.decode("utf-8", "replace"))+def transcribe(self, audio, language=None, keywords=None, word_timestamps=False) -> dict:"""Returns {"text", "language", "ttft_ms", "decode_tps"}, plus "words" with start, end and probability when word_timestamps is set.@@ -113,14 +132,28 @@ class Whistle:"""lib = self._bind()samples, count = _samples(audio)- if keywords is not None and not isinstance(keywords, str):- keywords = "\n".join(keywords)- code = lib.needle_transcribe(samples, count, language.encode("utf-8") if language else None,- keywords.encode("utf-8") if keywords else None, int(bool(word_timestamps)),- self._buffer, len(self._buffer))- if code < 0:- raise RuntimeError(lib.needle_last_error().decode("utf-8", "replace"))- return json.loads(self._buffer.value.decode("utf-8", "replace"))+ language, keywords = _options(language, keywords)+ return self._result(lib.needle_transcribe(samples, count, language, keywords, int(bool(word_timestamps)),+ self._buffer, len(self._buffer)))++ def stream(self, chunks, language=None, keywords=None):+ """Live transcription: one dict per chunk, then one for the tail when the chunks end.++ chunks are 16 kHz mono float sample buffers, about a second each, with no limit on the total. Each dict has the+ "text" and "words" committed by that chunk, with times from the start of the stream, the unconfirmed "pending"+ tail, the "language", the seconds "received" and the "pass_ms" it took. Join the texts with a space.+ """+ lib = self._bind()+ language, keywords = _options(language, keywords)+ try:+ for chunk in chunks:+ samples, count = _samples(chunk)+ yield self._result(lib.needle_stream_transcribe_process(samples, count, language, keywords, self._buffer,+ len(self._buffer)))+ except BaseException:+ lib.needle_stream_transcribe_stop(self._buffer, len(self._buffer))+ raise+ yield self._result(lib.needle_stream_transcribe_stop(self._buffer, len(self._buffer)))def embed(self, audio) -> list[float]:"""The encoder output, one row of floats per 80 ms frame, flattened."""@@ -160,10 +193,24 @@ def transcribe(audio, language=None, keywords=None, word_timestamps=False, weighword_timestamps=word_timestamps)+def stream(chunks, language=None, keywords=None, weights=None):+ """Live transcription on the model this process already has loaded: Whistle.stream with no limit on length.++ chunks are 16 kHz mono float sample buffers, about a second each. Yields one dict per chunk with the "text"+ and "words" committed by it, the unconfirmed "pending" tail, the "language", the seconds "received" and+ "pass_ms", then one for the tail when the chunks end.+ """+ from .._telemetry import track++ track("stream", {"tuned": bool(weights)})+ return _shared_model(weights).stream(chunks, language=language, keywords=keywords)++PLAYGROUND_HELP = """ Enter speak, Enter again to stop/language de force a language (en de fr es it nl pl), bare to detect it/keywords Siobhan, Krzysztof/timestamps toggle word times+ /stream toggle live transcription, the words printing as they are committed/file clip.wav transcribe a file/quit leave"""COMPARE_HELP = """ Enter speak, Enter again to stop@@ -171,6 +218,8 @@ COMPARE_HELP = """ Enter speak, Enter again to stop/quit leave"""COMPARE_INSTALL = 'pip install "cactus-needle[mic,compare]"'CLEAR_ABOVE = "\x1b[1A\x1b[2K"+DIM = "\x1b[90m"+PLAIN = "\x1b[0m"LIMIT_SECONDS = 30@@ -215,6 +264,75 @@ def record():return audio if rate == SAMPLE_RATE else soxr.resample(audio, rate, SAMPLE_RATE, quality="HQ")+def listen(whistle, state):+ try:+ import numpy+ import sounddevice+ import soxr+ except ImportError as error:+ raise RuntimeError(f'{error.name} is not installed: pip install "cactus-needle[mic]"') from None+ heard, steps, failed = queue.Queue(), [], []++ def chunks():+ block, held = [], 0+ while True:+ data = heard.get()+ if data is not None:+ block.append(data)+ held += len(data)+ if block and (held >= SAMPLE_RATE or data is None):+ yield numpy.concatenate(block)+ block, held = [], 0+ if data is None:+ return++ def show():+ committed, drawn = "", ()+ try:+ for step in whistle.stream(chunks(), language=state["language"], keywords=state["keywords"]):+ steps.append(step)+ committed += (" " if committed and step["text"] else "") + step["text"]+ columns = max(shutil.get_terminal_size().columns, 1)+ up = sum((len(line) - 1) // columns for line in drawn if line) + 1 if drawn else 0+ drawn = (committed, step["pending"])+ print((f"\r\x1b[{up}A\x1b[J" if up else "\r\x1b[J") + committed + "\n" + DIM + step["pending"] + PLAIN, end="", flush=True)+ except (RuntimeError, OSError) as error:+ failed.append(error)++ worker = threading.Thread(target=show, daemon=True)+ try:+ rate = int(sounddevice.query_devices(kind="input")["default_samplerate"])+ resampler = soxr.ResampleStream(rate, SAMPLE_RATE, 1, dtype="float32", quality="HQ") if rate != SAMPLE_RATE else None+ capture = lambda data, *_: heard.put(resampler.resample_chunk(data[:, 0]) if resampler else data[:, 0].copy())+ with sounddevice.InputStream(samplerate=rate, channels=1, dtype="float32", callback=capture):+ print(CLEAR_ABOVE + "● recording, Enter to stop")+ worker.start()+ try:+ input()+ except (EOFError, KeyboardInterrupt):+ print()+ print("\x1b[1A", end="", flush=True)+ if resampler:+ heard.put(resampler.resample_chunk(numpy.zeros(0, numpy.float32), last=True))+ except sounddevice.PortAudioError as error:+ raise RuntimeError(f"no microphone: {error}") from None+ finally:+ heard.put(None)+ if worker.is_alive():+ worker.join()+ if failed:+ raise RuntimeError(failed[0])+ words = [word for step in steps for word in step["words"]]+ if not words:+ print("(no speech)")+ if state["timestamps"]:+ for word in words:+ print(f" {word['start']:6.2f} - {word['end']:5.2f} {word['word']:<20} {word['probability']:.2f}")+ passes = [step["pass_ms"] for step in steps if step["pass_ms"]]+ print(f" {'whistle':<18}{os.path.getsize(whistle.weights) / 1e6:>4.0f} MB audio {steps[-1]['received']:5.1f} s"+ f" pass {sum(passes) / max(len(passes), 1):4.0f} ms {steps[-1]['language'] or 'no speech'}")++def prompt():try:return input("› ").strip()@@ -239,7 +357,8 @@ def show_transcript(whistle, audio, state):def playground(args):- state = {"language": args.language, "keywords": [k.strip() for k in args.keywords.split(",") if k.strip()], "timestamps": args.word_timestamps}+ state = {"language": args.language, "keywords": [k.strip() for k in args.keywords.split(",") if k.strip()], "timestamps": args.word_timestamps,+ "stream": False}print("whistle playground: downloading and initializing the model...", flush=True)whistle = Whistle(weights=args.weights)if args.audio:@@ -263,11 +382,14 @@ def playground(args):elif command == "/timestamps":state["timestamps"] = not state["timestamps"]print(" word timestamps", "on" if state["timestamps"] else "off")+ elif command == "/stream":+ state["stream"] = not state["stream"]+ print(" live transcription", "on" if state["stream"] else "off")elif command == "/file":show_transcript(whistle, audio_path(rest), state)elif line == "":try:- show_transcript(whistle, record(), state)+ listen(whistle, state) if state["stream"] else show_transcript(whistle, record(), state)except RuntimeError as error:print(f" {error}")else:diff --git a/tests/test_whistle.py b/tests/test_whistle.pyindex cbe3f56..7bbc722 100644--- a/tests/test_whistle.py+++ b/tests/test_whistle.py@@ -1,4 +1,5 @@import array+import jsonimport mathimport osimport struct@@ -244,6 +245,151 @@ def test_record_says_what_is_missing(monkeypatch):record()+class _StreamEngine:+ def __init__(self):+ self.calls = []++ def needle_load(self, data, size):+ return 0++ def needle_last_error(self):+ return b"stream broke"++ def _write(self, out, text, received):+ payload = json.dumps({"text": text, "words": [{"word": text, "start": 0.0, "end": 0.5, "probability": 1.0}] if text else [],+ "pending": "tail", "language": "en", "received": received, "pass_ms": 7.0}).encode()+ out.value = payload+ return len(text.split())++ def needle_stream_transcribe_process(self, samples, count, language, keywords, out, capacity):+ self.calls.append(("feed", count, language, keywords))+ if count < 0:+ return -1+ return self._write(out, str(count), len(self.calls))++ def needle_stream_transcribe_stop(self, out, capacity):+ self.calls.append(("finish",))+ return self._write(out, "tail", len(self.calls))+++def test_stream_feeds_each_chunk_and_flushes_the_tail(monkeypatch):+ from needle.agent import whistle++ engine = _StreamEngine()+ monkeypatch.setattr(whistle, "_lib", lambda: engine)+ monkeypatch.setattr(whistle, "_loaded", None)+ model = whistle.Whistle(weights=__file__)+ steps = list(model.stream([[0.0] * 3, [0.0] * 2], language="de", keywords=["Siobhan", "Krzysztof"]))+ assert [step["text"] for step in steps] == ["3", "2", "tail"] and steps[-1]["received"] == 3+ assert engine.calls == [("feed", 3, b"de", b"Siobhan\nKrzysztof"), ("feed", 2, b"de", b"Siobhan\nKrzysztof"), ("finish",)]+ engine.calls.clear()+ live = model.stream([[0.0]])+ assert next(live)["text"] == "1"+ live.close()+ assert engine.calls == [("feed", 1, None, None), ("finish",)]+++def test_module_level_stream_reuses_one_model(monkeypatch):+ import needle+ from needle.agent import whistle++ class _Fake:+ def __init__(self, weights=None):+ self.weights = weights++ def stream(self, chunks, language=None, keywords=None):+ for chunk in chunks:+ yield {"text": f"{len(chunk)} {language} {keywords} {self.weights}"}++ monkeypatch.setattr(whistle, "Whistle", _Fake)+ monkeypatch.setattr(whistle, "_shared", {})+ monkeypatch.setattr("needle._telemetry.track", lambda *a, **k: None)+ assert [s["text"] for s in needle.stream([[0.0] * 2], language="de", keywords=["Siobhan"])] == ["2 de ['Siobhan'] None"]+ assert next(needle.stream([[0.0]], weights="tuned.cact"))["text"] == "1 None None tuned.cact"+ assert set(whistle._shared) == {None, "tuned.cact"}+++def test_stream_raises_the_engine_error(monkeypatch):+ from needle.agent import whistle++ class Broken(_StreamEngine):+ def needle_stream_transcribe_process(self, *args):+ return -1++ monkeypatch.setattr(whistle, "_lib", lambda: Broken())+ monkeypatch.setattr(whistle, "_loaded", None)+ with pytest.raises(RuntimeError, match="stream broke"):+ list(whistle.Whistle(weights=__file__).stream([[0.0]]))+++class _LiveWhistle:+ weights = __file__++ def __init__(self):+ self.chunks, self.options = [], None++ def stream(self, chunks, **options):+ self.options = options+ for chunk in chunks:+ self.chunks.append(len(chunk))+ yield {"text": f"chunk{len(self.chunks)}", "words": [{"word": f"chunk{len(self.chunks)}", "start": 0.1, "end": 0.4, "probability": 0.9}],+ "pending": "tail", "language": "en", "received": float(len(self.chunks)), "pass_ms": 20.0}+ yield {"text": "tail", "words": [{"word": "tail", "start": 0.5, "end": 0.9, "probability": 0.8}], "pending": "", "language": "en",+ "received": float(len(self.chunks)), "pass_ms": 0.0}+++def test_listen_feeds_the_microphone_in_seconds_and_prints_words_live(monkeypatch, capsys):+ pytest.importorskip("numpy")+ pytest.importorskip("soxr")+ from needle.agent.whistle import listen++ monkeypatch.setitem(sys.modules, "sounddevice", _Microphone(48000, 3))+ monkeypatch.setattr("builtins.input", lambda *_: "")+ whistle = _LiveWhistle()+ listen(whistle, {"language": "de", "keywords": ["Siobhan"], "timestamps": True})+ assert whistle.options == {"language": "de", "keywords": ["Siobhan"]}+ assert abs(sum(whistle.chunks) - 3 * 16000) <= 2 and all(n >= 16000 for n in whistle.chunks[:-1])+ out = capsys.readouterr().out+ assert "recording, Enter to stop" in out and "chunk1 " in out and " tail" in out+ assert "\r\x1b[J" + "chunk1\n\x1b[90mtail\x1b[0m" in out and "\r\x1b[1A\x1b[J" + "chunk1 chunk2\n" in out+ assert " ".join(f"chunk{n}" for n in range(1, len(whistle.chunks) + 1)) + " tail\n\x1b[90m\x1b[0m" in out+ assert "0.10 - 0.40 chunk1" in out and "0.50 - 0.90 tail" in out+ assert f"audio {len(whistle.chunks):.1f} s" in out and "pass 20 ms en" in out+++def test_listen_reports_a_broken_stream(monkeypatch, capsys):+ pytest.importorskip("numpy")+ pytest.importorskip("soxr")+ from needle.agent.whistle import listen++ class Broken:+ weights = __file__++ def stream(self, chunks, **options):+ raise RuntimeError("no speech model loaded")+ yield++ monkeypatch.setitem(sys.modules, "sounddevice", _Microphone(16000, 1))+ monkeypatch.setattr("builtins.input", lambda *_: "")+ with pytest.raises(RuntimeError, match="no speech model loaded"):+ listen(Broken(), {"language": None, "keywords": [], "timestamps": False})+++def test_playground_listens_on_enter_once_streaming_is_on(monkeypatch, capsys):+ from needle.agent import whistle++ lines = iter(["", "/stream", "", "/stream", "", "/quit"])+ heard = []+ monkeypatch.setattr(whistle, "prompt", lambda: next(lines))+ monkeypatch.setattr(whistle, "record", lambda: heard.append("recorded") or [0.0])+ monkeypatch.setattr(whistle, "show_transcript", lambda model, audio, state: heard.append(audio))+ monkeypatch.setattr(whistle, "listen", lambda model, state: heard.append(state["language"]))+ monkeypatch.setattr("needle.agent.whistle.Whistle", lambda weights=None: _Whistle({}))+ whistle.playground(type("Args", (), {"audio": None, "language": "en", "keywords": "", "word_timestamps": False, "weights": None})())+ assert heard == ["recorded", [0.0], "en", "recorded", [0.0]]+ assert "live transcription on" in capsys.readouterr().out++def test_rate_counts_steps_after_the_first_mark():from needle.agent.whistle import rate