To reproduce this issue, add the test cases to the speech_recognition module specifically for error handling in the recognize_whisper_api function.
Run the tests with cases for missing API key, invalid audio data, and missing openai module. Code examples of each scenario are included above.
If necessary, also include an audio file that simulates invalid or unexpected audio data.
Expected behaviour
I expected the recognize_whisper_api function to:
Raise a SetupError when the API key is missing.
Raise a ValueError when invalid audio data is provided.
Raise a SetupError with a specific error message when the openai module is not found.
Actual behaviour
Instead of the expected behavior, the function did not handle one or more of these exceptions correctly (e.g., it failed to detect the missing API key, invalid audio data, or missing openai module). Please refer to the specific test cases for details.
(If any exceptions are thrown during testing, paste the full stack trace here for each case.)
System information
My system is MacOS.
My Python version is 3.12.3.
My Pip version is 24.2.
My SpeechRecognition library version is 3.8.1.
My PyAudio library version is not installed.
My microphones are: ['Microphone 1', 'Microphone 2'].
My working microphones are: ['Microphone 1'].
Steps to reproduce
speech_recognition
module specifically for error handling in therecognize_whisper_api
function.openai
module. Code examples of each scenario are included above.Expected behaviour
I expected the
recognize_whisper_api
function to:SetupError
when the API key is missing.ValueError
when invalid audio data is provided.SetupError
with a specific error message when theopenai
module is not found.Actual behaviour
Instead of the expected behavior, the function did not handle one or more of these exceptions correctly (e.g., it failed to detect the missing API key, invalid audio data, or missing
openai
module). Please refer to the specific test cases for details.System information
My system is MacOS.
My Python version is 3.12.3. My Pip version is 24.2.
My SpeechRecognition library version is 3.8.1.
My PyAudio library version is not installed.
My microphones are: ['Microphone 1', 'Microphone 2'].
My working microphones are: ['Microphone 1'].
I installed PocketSphinx from Homebrew.