fix(python-sdk): send Parakeet finalize when run() is cancelled

Merged
DA
2mo ago
+47-9

Fixes #13631.

Cancelling ParakeetTranscriber.run() tore down the WebSocket without sending Parakeet's finalize frame. Remaining transcription results can be dropped. Send finalize on caller cancellation, then let the connection close. Server EOF still returns and does not send finalize. Related: Python Deepgram #13626; Dart/RN/TS Parakeet stop() already send finalize.

Validation

  • Reproduced on origin/main d5cbd548f6 with a patched websockets.connect fake: cancelling run() closed the socket with no finalize frame.
  • After the fix, pytest tests/test_parakeet_lifecycle.py is 7 passed. Caller cancel records finalize before close; server EOF does not. No live Parakeet, credentials, or audio.

AI-assisted contribution. Bounty eligibility remains a maintainer decision.

Made with Cursor