From 4c23d8c5f2da5ac4c3a296369ee1bcf4e6cddf71 Mon Sep 17 00:00:00 2001 From: fei <204683769+feiiiiii5@users.noreply.github.com> Date: Sun, 25 Oct 2026 12:03:44 +0800 Subject: [PATCH] DOC: Correct the audio scoring docstring's failure contract _score_audio_async never raises ValueError: a failed transcription re-raises the converter's own exception, and an empty transcript returns an empty list of scores instead of erroring. --- pyrit/score/audio_transcript_scorer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyrit/score/audio_transcript_scorer.py b/pyrit/score/audio_transcript_scorer.py index a8adf1fc72..f775a88430 100644 --- a/pyrit/score/audio_transcript_scorer.py +++ b/pyrit/score/audio_transcript_scorer.py @@ -159,11 +159,13 @@ async def _score_audio_async( expectation (ScoringExpectation | None): Criteria forwarded to the transcript scorer. Returns: - List of scores for the transcribed audio. + List of scores for the transcribed audio, or an empty list when the + transcript is empty (there is no text to score). Raises: FileNotFoundError: If the audio file does not exist. - ValueError: If transcription fails or returns empty text. + Exception: Whatever the transcription step raises when it fails; the + original exception is re-raised as-is (see ``_transcribe_audio_async``). """ audio_path = message_piece.converted_value