Open ftnext opened 1 year ago
Add this to your code:
os.environ['OPENAI_API_KEY'] = 'API_KEY_HERE'
recongnize_whisper_api()
tries to get an environment variable called "OPENAI_API_KEY", this sets that variable. Add this to your code instead of adding an argument to recongnize_whisper_api()
.
Steps to reproduce
pip install 'SpeechRecognition[whisper-api]' pyaudio
examples/microphone_recognition.py
and comment out other recognizershttps://github.com/Uberi/speech_recognition/blob/8b07762f80dfec2d34fb4c40b8eddbb7ec503521/examples/microphone_recognition.py#L97
examples/microphone_recognition.py
Expected behaviour
See Whisper API response.
Actual behaviour
See the following error.
It seems that
api_key
is not passed to Whisper API request.✨Workaround
Set
OPENAI_API_KEY
.export
or pass likeSystem information
My system is macOS Monterey.
My Python version is Python 3.10.9.
My Pip version is pip 23.0.1.
My SpeechRecognition library version is 3.10.0.
My PyAudio library version is 0.2.13.