Skip to content

refactor(transcriber): move prerecorded transcription into prerecorded/v2 - #226

Merged
ccampbell-aai merged 1 commit into
masterfrom
ccampbell/python-prerecorded-rearchitecture
Aug 11, 2026
Merged

refactor(transcriber): move prerecorded transcription into prerecorded/v2#226
ccampbell-aai merged 1 commit into
masterfrom
ccampbell/python-prerecorded-rearchitecture

Conversation

@ccampbell-aai

Copy link
Copy Markdown
Contributor

Summary

Continues the SDK rearchitecture (following sync/v1, #214/#216, and streaming/v3): the async (prerecorded) product moves into a versioned subpackage, assemblyai/prerecorded/v2/ (v2 = the /v2/transcript API).

  • transcriber.pyprerecorded/v2/{transcript,transcript_group,client}.py — one public class per module beside its private impl (Transcript/_TranscriptImpl, TranscriptGroup/_TranscriptGroupImpl, Transcriber/_TranscriberImpl), layered transcript ← transcript_group ← client with no circular imports. Class bodies are byte-identical to the originals; only module headers/imports changed.
  • Transcript-only pieces of api.py (ENDPOINT_TRANSCRIPT + 10 functions) move to prerecorded/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__.py is the public facade (Transcriber, Transcript, TranscriptGroup, TranscriptionConfig).

Backwards compatibility

No behavior change; every existing import path resolves to the identical objects:

  • flat assemblyai/transcriber.py is now a silent re-export shim (same idiom as assemblyai/sync/__init__.py), including the private _*Impl names;
  • root api.py re-exports the moved names, so from assemblyai.api import ENDPOINT_TRANSCRIPT, ... keeps working;
  • root assemblyai/__init__.py is untouched;
  • new tests/unit/test_transcriber_backwards_compat.py pins old-path/new-path identity, the private surface, and warning-free imports.

Testing

  • Full suite: 391 passed (385 at base + 6 new backwards-compat tests)
  • Smoke-tested imports under warnings.simplefilter('error') from all entry orders (assemblyai first, assemblyai.prerecorded.v2.api first, assemblyai.api first)
  • ruff check + format clean on all touched files

🤖 Generated with Claude Code

…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>
@ccampbell-aai

Copy link
Copy Markdown
Contributor Author

Live backwards-compatibility verification

In 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 (import assemblyai as aai, assemblyai.transcriber, assemblyai.api), with results deep-compared as normalized JSON. A single shared transcript was created up front so read-path outputs could be compared byte-for-byte.

All ten relocated api.py functions were exercised:

check covers result
transcribe_e2e upload_file + create_transcript + get_transcript polling ✅ identical
get_by_id get_transcript (full word list incl. confidences) ✅ identical
word_search word_search ✅ identical
subtitles export_subtitles_srt / export_subtitles_vtt ✅ identical
sentences_paragraphs get_sentences / get_paragraphs ✅ identical
list_transcripts list_transcripts (before_id-pinned page) ✅ identical
transcript_group TranscriptGroup.get_by_ids ✅ identical
redacted_audio (+ client-side guard) get_redacted_audio via a redact_pii transcription ✅ identical (stable parts of signed URL)
delete_own delete_transcript ✅ identical

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 word_search matches (the comparison pins confidence to the shared transcript and sorts matches by term). Module metadata (aai.Transcriber.__module__: assemblyai.transcriberassemblyai.prerecorded.v2.client) differs by design and was excluded.

🤖 Generated with Claude Code

@ccampbell-aai
ccampbell-aai marked this pull request as ready for review August 11, 2026 19:33
@ccampbell-aai
ccampbell-aai merged commit 9a251f2 into master Aug 11, 2026
7 checks passed
@ccampbell-aai
ccampbell-aai deleted the ccampbell/python-prerecorded-rearchitecture branch August 11, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants