Repository navigation
feat(asr): send the Pro model options from transcribe() - #209
Conversation
The SDK points callers to transcribe-2-pro, which by default puts speaker
markers (<|speaker:0|>) and event cues ([laughter]) in text, but
transcribe() could not send the fields that control them, so a caller who
wanted the plain transcript had to call POST /v1/asr directly.
transcribe() (sync and async) now takes tag_audio_events, diarize (True,
False or "auto"), num_speakers, min_speakers, max_speakers, text_format
("written" or "spoken"), verbatim and keyterms. They go in the MessagePack
body typed as the API requires: booleans, integers, a boolean or "auto"
for diarize, and an array of strings for keyterms. An option left as None
is not sent, so a request without options is byte for byte as before. The
API checks values and combinations itself and ignores fields a model does
not use; the SDK only refuses keyterms given as a string, which would
otherwise be sent as one term per character.
…choing them list() turned a dict into its keys and a string into its characters, and the API accepts either. keyterms must now be a sequence that is not a str, bytes or mapping (a list, a tuple or another Sequence); anything else raises TypeError before sending. The message names the type and shows the right form, but not the value: a glossary can hold customer or product names, and exceptions get logged. The terms themselves stay the API's to check. The README and docstrings say that verbatim=False asks the model to leave out fillers and false starts.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the added ASR options, validation, serialization, exports, tests, and documentation.
No open issues 🎉
What changed in this PR
Adds Pro-model transcription options to synchronous and asynchronous asr.transcribe() calls while preserving existing request bodies when options are unset.
Changes:
- Adds typed options for diarization, event tagging, speaker counts, formatting, verbatim output, and keyterms.
- Exports new ASR option types and updates tests and documentation.
| File | Description |
|---|---|
| tests/unit/test_asr.py | Tests synchronous and asynchronous option serialization and validation. |
| src/fishaudio/types/asr.py | Defines the new ASR diarization and text-format types. |
| src/fishaudio/types/__init__.py | Exports the new ASR option types. |
| src/fishaudio/resources/asr.py | Adds validation and request serialization for transcription options. |
| README.md | Documents plain Pro-model transcripts and supported transcription options. |
Review effort: Lite
transcribe-2-proputs speaker markers (<|speaker:0|>) and event cues ([laughter]) intextby default, and the API has fields to control them and more.asr.transcribe()could not send any of them, so getting a plain transcript meant callingPOST /v1/asrdirectly.Before
transcribe()sent onlyaudio,languageandignore_timestamps.transcribe-2-pro, the transcript always had speaker markers and cues.After
transcribe()(sync and async) takestag_audio_events,diarize(True,Falseor"auto"),num_speakers,min_speakers,max_speakers,text_format("written"or"spoken"),verbatimandkeyterms.keyterms.Noneis not sent, so existing calls send exactly the same bytes as before.keytermsthat is not a list-like sequence of terms (a single string, or a dict), which would otherwise be sent as characters or keys.ASRDiarize,ASRTextFormat.Verification
transcribe-2-pro:diarize=False+tag_audio_events=Falsereturns text with no markers or cues;text_format="spoken"writes "three hundred dollars";verbatim=Falseremoves fillers;keyterms=["Kubernetes"]fixes a misheard term;transcribe-1-proandtranscribe-1ignore the fields they do not use.Not covered
stream_websocket) is unchanged; it already hasdiarizeandtag_audio_events.keyterms, the API may not followverbatim=Falseortext_format="spoken". That is API behaviour; thekeytermsdocstring says so.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.