offmute-v2 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,167 +1,96 @@
1
1
  # offmute-v2
2
2
 
3
- Best-in-class diarized meeting transcription. A video/audio file (plus optional
4
- instructions) goes in; a **timestamp-correct, diarized transcript with tone/behavior
5
- labels** comes out — as SRT, Markdown, and JSON.
3
+ **Timestamp-correct, diarized meeting transcription** — a video/audio file goes in; a
4
+ speaker-labelled, tone-annotated transcript with accurate timestamps comes out (SRT / Markdown /
5
+ JSON). It fuses a multimodal LLM (content, diarization, tone, speaker identity) with an ASR model
6
+ (word-level timing), aligned together. Runs as an npx CLI, a Node library, and in the browser.
6
7
 
7
- Runs as an **npx CLI**, a **Node library**, and **in the browser**.
8
+ > 📝 **Full write-up:** _"offmute-v2: GLM vs Opus"_ — **coming soon** at
9
+ > http://southbridge.ai/blog/offmute-v2-glm-vs-opus
8
10
 
9
- > Living context: `intermediates/process_log_thoughts_ideas_hypotheses_and_scratch_space.md`
10
- > (hypotheses, findings, gotchas) and `docs/spec.md` (design). Re-read when context compresses.
11
+ ---
11
12
 
12
- ## Results (verified on test-files/1: 32min talk + audience Q&A)
13
+ ## This repo is an agent-vs-agent experiment
13
14
 
14
- End-to-end pipeline vs the hand-checked reference SRT (38 entries):
15
+ offmute-v2 was built **twice, from a single identical prompt**, by two different models running in
16
+ **Claude Code** — as a head-to-head of how each does on a hard, AI-resistant build (combining the
17
+ ideas from [offmute], [meeting-diary], and [ipgu] into one timestamp-accurate diarizer):
15
18
 
16
- | metric | result |
17
- |---|---|
18
- | word accuracy (WER) | **86.5%** (WER 0.135) |
19
- | reference coverage | **38/38** entries covered |
20
- | boundary timing | **median 0.00s, p90 2.16s** |
21
- | speaker accuracy | **94%** |
22
- | alignment | 326/326 segments aligned to ASR word timing |
19
+ | Branch | Built by | npm | What it is |
20
+ |--------|----------|-----|------------|
21
+ | [`glm`](../../tree/glm) | **GLM-5.2** | `offmute-v2@latest` / `@glm` | the **primary**, daily-driven build |
22
+ | [`opus`](../../tree/opus) | **Claude Opus 4.8** | `offmute-v2@opus` | the comparison build, preserved with full history |
23
+ | `master` | — | — | this overview + the current primary (tracks `glm` for now; may diverge) |
23
24
 
24
- Speaker diarization correctly separates the presenter (named **Rishi** via the
25
- identification pass) from 3 audience questioners, merging an AssemblyAI over-split of
26
- the presenter into two speakers.
25
+ The two branches have **independent histories** — each is the full, unedited commit trail of that
26
+ model's build, including every review round and fix (so you can read exactly what happened).
27
27
 
28
- ## How it works
28
+ ## The receipts (per branch, in `docs/`)
29
29
 
30
- A **hybrid** of two complementary strengths (the `inspirations/` projects each had one):
30
+ Each build branch carries its own review trail:
31
31
 
32
- - **Multimodal LLM** (Gemini) → best *content*: verbatim text, tone, diarization through
33
- interruptions, speaker identification via context. Coarse timestamps only.
34
- - **Timestamped transcriber** (AssemblyAI Universal-2) → best *timing*: word-accurate
35
- timestamps + clean speaker separation over the whole file. No tone/context.
32
+ - `docs/spec.md` — the plan & hypotheses
33
+ - `docs/review-1/` — first run-through review + the model's diagnosed fixes
34
+ - `docs/review-2/` — code-read + independent review + fixes
35
+ - `docs/comparison-response.md` (glm) / `docs/review-comparison-fixes.md` (opus) — each model's
36
+ response to the cross-model comparison
37
+ - `intermediates/process_log_*.md` — the model's append-only dev journal
36
38
 
37
- ```
38
- preprocess → describe → llm-transcribe (per chunk) → timestamped (whole file)
39
- ↓
40
- align (edit-distance: LLM text ↔ ASR word times)
41
- ↓
42
- gap-fill (recover dropped content from ASR)
43
- ↓
44
- consistency (merge ASR over-splits via LLM labels)
45
- ↓
46
- identify (optional, DeepSeek: name speakers from content)
47
- ↓
48
- finalize (dedup, overlap fix, clamp, format SRT/MD/JSON)
49
- ```
50
-
51
- **The alignment** is the key idea (ts-aligner approach): align the whole chunk's LLM
52
- token stream against the ASR word stream in one edit-distance DP pass, then split back
53
- into segments — long ordered sequences pin common words unambiguously and transfer
54
- accurate word timestamps onto the richer LLM text.
55
-
56
- **Gap-fill** recovers content the LLM dropped: where ASR has speech in a time gap not
57
- covered by any LLM segment (e.g. a dropped opening word), an ASR fallback segment is
58
- inserted — so nothing the ASR heard is lost.
59
-
60
- **Timestamped providers**: AssemblyAI Universal-2 (default — diarization + word
61
- timestamps) or Groq Whisper (`--timestamped whisper-groq` — free/fast word timestamps,
62
- no diarization; consistency then groups by LLM label).
63
-
64
- ## Diarization levels (selectable via `--level`)
39
+ Browse them on [`glm`](../../tree/glm/docs) and [`opus`](../../tree/opus/docs).
65
40
 
66
- 1. **Separation** — who speaks when (ASR speakers).
67
- 2. **Anonymous-but-consistent** — Speaker A/B throughout (ASR speakers merged by LLM label; default).
68
- 3. **Identification** — named speakers via content cues (DeepSeek).
41
+ ## Quick start
69
42
 
70
- ## Usage
71
-
72
- ### npx CLI
73
43
  ```bash
74
- export GEMINI_API_KEY=... # multimodal transcription
75
- export ASSEMBLYAI_API_KEY=... # timestamped transcription
76
- export DEEPSEEK_API_KEY=... # optional, for --level 3 identification
77
-
78
- npx offmute-v2 meeting.mov # default: flash model, level 2
79
- npx offmute-v2 meeting.mov --model gemini-2.5-pro # higher quality
80
- npx offmute-v2 meeting.mov --level 3 # name speakers
81
- npx offmute-v2 meeting.mov -i "focus on action items, note accents"
82
- npx offmute-v2 meeting.mov --passes align,consistency,finalize # resume from intermediates
83
- npx offmute-v2 meeting.mov --only-chunk 2 # debug one chunk
44
+ export GEMINI_API_KEY=... # multimodal transcription (or GOOGLE_API_KEY)
45
+ export ASSEMBLYAI_API_KEY=... # word-level timing
46
+
47
+ # primary (GLM) build:
48
+ npx offmute-v2@latest meeting.mp4
49
+ # explicitly pin a build:
50
+ npx offmute-v2@glm meeting.mp4
51
+ npx offmute-v2@opus meeting.mp4
84
52
  ```
85
53
 
86
- Key options: `--passes`, `--level <1|2|3>`, `--model`, `--timestamped assemblyai|whisper-groq`,
87
- `--formats srt,md,json`, `--chunk-seconds`, `--overlap-seconds`, `--concurrency`,
88
- `--instructions`, `--force`, `--only-chunk`, `--reasoner`.
54
+ As a library (this `master`/GLM line takes a single options object — `input` and `outputDir`
55
+ are required):
89
56
 
90
- ### Node library
91
57
  ```ts
92
58
  import { transcribe } from "offmute-v2";
93
- const result = await transcribe("meeting.mov", {
94
- model: "gemini-2.5-flash",
95
- level: 3,
96
- instructions: "...",
97
- apiKeys: { gemini: "...", assemblyai: "...", deepseek: "..." }, // injectable
98
- formats: ["srt", "md", "json"],
99
- });
100
- // result.segments: Segment[], result.speakers: SpeakerInfo[]
101
- ```
102
59
 
103
- ### Browser
104
- ```ts
105
- import { transcribeBrowser } from "offmute-v2/browser";
106
- // audio = mono Blob (extract from video via ffmpeg.wasm first)
107
- const result = await transcribeBrowser({
108
- audio, geminiApiKey, assemblyaiApiKey,
109
- model: "gemini-2.5-flash", level: 3, deepseekApiKey,
60
+ const { segments, speakers } = await transcribe({
61
+ input: "meeting.mp4",
62
+ outputDir: "./out",
63
+ model: "gemini-flash-latest", // or gemini-2.5-pro, gemini-3.1-pro-preview, …
64
+ formats: ["srt", "md", "json"],
65
+ // apiKeys: { gemini, assemblyai } // optional; falls back to env
110
66
  });
111
67
  ```
112
- The core (align/consistency/identify/finalize/format) is pure TS with no node deps and
113
- bundles to ~35KB with zero node-only imports. The browser build uses fetch-based
114
- providers (Gemini inline base64 + AssemblyAI REST). Best for audio ≤ ~20MB inline; for
115
- longer files, chunk with ffmpeg.wasm and call the stages directly.
116
-
117
- ## Architecture
118
68
 
119
- ```
120
- src/
121
- core/ types, config (models, key resolution, chunk planning), pipeline
122
- audio/ ffmpeg wrapper (probe, audio, chunk, scene-aware keyframes, silence)
123
- providers/ gemini (SDK), gemini-fetch + assemblyai-fetch (browser), openai-compat (DeepSeek/Groq)
124
- transcribe/ llm transcription (prompt + JSON schema), describe (roster)
125
- align/ normalize, edit-distance DP, aligner (flat-sequence alignment)
126
- diarize/ consistency (merge by LLM label), identify (DeepSeek naming)
127
- finalize/ dedup, overlap fix + clamp, format (SRT/MD/JSON with block-breaking)
128
- eval/ scorer (WER, coverage, timing, speaker agreement vs reference)
129
- utils/ time, srt, logger
130
- scripts/ per-stage test scripts + eval
131
- tests/ vitest unit tests (align, finalize)
132
- ```
69
+ Both branches publish the same `offmute-v2` CLI and library; they differ in pipeline internals (e.g.
70
+ GLM's ASR-backbone consistency + gap-fill, Opus's ownership-partition merge + voice-anchored
71
+ identify) and in the library call shape (the Opus build uses `transcribe(input, options)`). See each
72
+ branch's README and [`RELEASING.md`](RELEASING.md) for the `latest` / `glm` / `opus` npm tags.
133
73
 
134
- Every pipeline stage persists intermediates to disk and is **resumable** (skips work
135
- whose output exists unless `--force`); the run is **stoppable** — results so far are
136
- always on disk.
74
+ ## Build from source
137
75
 
138
- ## Development
139
76
  ```bash
140
- npm install
141
- npm run typecheck && npm run lint && npm test # 16 unit tests
142
- npm run dev # tsx src/cli.ts
143
- npm run build # tsup → dist/ (node + browser bundles)
144
- ```
77
+ git clone https://github.com/SouthBridgeAI/offmute-v2.git
78
+ cd offmute-v2 && git checkout glm # or: opus
145
79
 
146
- ## Requirements
147
- - Node ≥ 20, ffmpeg/ffprobe in PATH.
148
- - API keys: `GEMINI_API_KEY` (or `GOOGLE_API_KEY`), `ASSEMBLYAI_API_KEY`. `DEEPSEEK_API_KEY` optional (level 3). `GROQ_API_KEY` optional (whisper-groq fallback).
149
-
150
- ## Eval
151
- ```bash
152
- npx tsx scripts/eval.ts path/to/output.json # score a run vs the reference SRT
80
+ # glm build (npm): npm ci && npm run build && npm test
81
+ # opus build (bun): bun install && bun run build && bun test
82
+ node dist/cli.js --help # (glm CLI entry is dist/cli.cjs)
153
83
  ```
154
84
 
155
- ## Reviews, fixes & receipts
156
- This build (the **GLM** branch) was reviewed and iterated in the open. The receipts:
157
- - **Spec & plan:** [`docs/spec.md`](docs/spec.md)
158
- - **Round 1** (run-through): [`docs/review-1/human-review.md`](docs/review-1/human-review.md) → fixes in [`docs/review-1/review-fixes.md`](docs/review-1/review-fixes.md)
159
- - **Round 2** (code read + independent review): [`docs/review-2/human-review.md`](docs/review-2/human-review.md), [`docs/review-2/REVIEW.md`](docs/review-2/REVIEW.md), [`docs/review-2/REVIEWER_GUIDE.md`](docs/review-2/REVIEWER_GUIDE.md) → fixes in [`docs/review-2/review-fixes.md`](docs/review-2/review-fixes.md)
160
- - **Response to the GLM-vs-Opus comparison:** [`docs/comparison-response.md`](docs/comparison-response.md)
161
- - **Dev journal:** [`intermediates/process_log_thoughts_ideas_hypotheses_and_scratch_space.md`](intermediates/process_log_thoughts_ideas_hypotheses_and_scratch_space.md)
162
- - **Releasing / npm tags:** [`RELEASING.md`](RELEASING.md)
163
-
164
- The Opus-built variant lives on the [`opus`](../../tree/opus) branch; the experiment overview is on [`master`](../../tree/master).
85
+ ## Requirements
86
+ - Node ≥ 20 and `ffmpeg`/`ffprobe` on PATH (CLI / library). Browser builds use ffmpeg.wasm.
87
+ - API keys from env or injected: `GEMINI_API_KEY` (or `GOOGLE_API_KEY`), `ASSEMBLYAI_API_KEY`;
88
+ optional `DEEPSEEK_API_KEY` / `GROQ_API_KEY` depending on the build/options.
165
89
 
166
90
  ## License
167
- Apache-2.0.
91
+ Apache-2.0. Built on [offmute], [meeting-diary], and [ipgu]. Credit to the model teams — including
92
+ [z.ai](https://z.ai) for GLM-5.2.
93
+
94
+ [offmute]: https://github.com/southbridgeai/offmute
95
+ [meeting-diary]: https://github.com/southbridgeai/meeting-diary
96
+ [ipgu]: https://github.com/hrishioa/ipgu