File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -962,6 +962,10 @@ def audio_transcribe(
962962 depend on the "verbose" parameter.
963963 Contains the transcribed text from the audio file.
964964 Includes error messages if verbosity is enabled.
965+
966+ Raises:
967+ ValueError: If engine is not 'bigquery'.
968+ RuntimeError: If the transcription result structure is invalid.
965969 """
966970 if engine .casefold () != "bigquery" :
967971 raise ValueError ("Must specify the engine, supported value is 'bigquery'." )
@@ -984,6 +988,10 @@ def audio_transcribe(
984988 model_params = {"generationConfig" : {"temperature" : 0.0 }},
985989 )
986990
991+ # Validate that the result is not None
992+ if transcribed_results is None :
993+ raise RuntimeError ("Transcription returned None result" )
994+
987995 transcribed_content_series = transcribed_results .struct .field ("result" ).rename (
988996 "transcribed_content"
989997 )
@@ -999,4 +1007,4 @@ def audio_transcribe(
9991007 results_struct = bbq .struct (results_df ).rename ("transcription_results" )
10001008 return results_struct
10011009 else :
1002- return transcribed_content_series . rename ( "transcribed_content" )
1010+ return transcribed_content_series
You can’t perform that action at this time.
0 commit comments