refactor(transcriber): move prerecorded transcription into prerecorded/v2 - #226
Conversation
…d/v2
Relocates the async (prerecorded) product into a versioned subpackage
mirroring sync/v1 and streaming/v3:
- transcriber.py -> prerecorded/v2/{transcript,transcript_group,client}.py,
one public class per module beside its private impl
- transcript-only endpoints split out of api.py into prerecorded/v2/api.py;
shared (upload_file, _get_error_message) and LeMUR pieces stay at root
- flat transcriber.py and api.py silently re-export the old surface, so
every existing import path keeps resolving to identical objects
- adds test_transcriber_backwards_compat.py pinning old/new path identity
(v0.64.34)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Live backwards-compatibility verificationIn addition to the in-repo compat tests, ran a live end-to-end comparison against the production API: the same set of prerecorded calls executed twice — once with the published PyPI package (0.64.32), once with this branch — using only pre-refactor import paths ( All ten relocated
10/10 identical. The only differences ever observed were server-side nondeterminism, reproduced within a single SDK version: per-word confidence drift between separate transcriptions of the same audio, and unstable ordering of 🤖 Generated with Claude Code |
Summary
Continues the SDK rearchitecture (following
sync/v1, #214/#216, andstreaming/v3): the async (prerecorded) product moves into a versioned subpackage,assemblyai/prerecorded/v2/(v2 = the/v2/transcriptAPI).transcriber.py→prerecorded/v2/{transcript,transcript_group,client}.py— one public class per module beside its private impl (Transcript/_TranscriptImpl,TranscriptGroup/_TranscriptGroupImpl,Transcriber/_TranscriberImpl), layeredtranscript ← transcript_group ← clientwith no circular imports. Class bodies are byte-identical to the originals; only module headers/imports changed.api.py(ENDPOINT_TRANSCRIPT+ 10 functions) move toprerecorded/v2/api.py. Shared pieces (upload_file,ENDPOINT_UPLOAD,_get_error_message) and the LeMUR endpoints stay at root — LeMUR gets its own subpackage in a later phase.prerecorded/v2/__init__.pyis the public facade (Transcriber,Transcript,TranscriptGroup,TranscriptionConfig).Backwards compatibility
No behavior change; every existing import path resolves to the identical objects:
assemblyai/transcriber.pyis now a silent re-export shim (same idiom asassemblyai/sync/__init__.py), including the private_*Implnames;api.pyre-exports the moved names, sofrom assemblyai.api import ENDPOINT_TRANSCRIPT, ...keeps working;assemblyai/__init__.pyis untouched;tests/unit/test_transcriber_backwards_compat.pypins old-path/new-path identity, the private surface, and warning-free imports.Testing
warnings.simplefilter('error')from all entry orders (assemblyaifirst,assemblyai.prerecorded.v2.apifirst,assemblyai.apifirst)🤖 Generated with Claude Code