So, fair warning, I’m an absolute newbie at coding so please have patience if I missed something completely obvious in my code.
My code is running on Google Colab and is meant to take mp3 audio files in a folder on my Google drive, transcribe them and post process them (ponctuation and misspelings).
Everything works dandy until I get to this portion:
AuthenticationError: Error code: 401 - {‘error’: {‘message’: ‘Incorrect API key provided: <your Op*******************************var>. You can find your API key at https://platform.openai.com/account/api-keys.’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘invalid_api_key’}}
I’ve followed suggestions I’ve seen on previous topics (multiple different formats, creating a new API Key), but I keep getting this error.
Any help is much appreciated for this newbie. Here’s the code:
Ey! Thank you so much for your warm welcome, I really appreciate it!
I was able to solve the problem and get the code working! The issue I was having was with the recognition of the environment variable as you said so.
First, I didn’t even have the environment variable properly setup at all (remember when I said I was a newbie? Yeah, that bad).
Then, because I was using google colab, I tried using the “secret keys” tab of google and tried to make that work in the code, like I’d seen in some forums and tutorials online, but I kept getting the same error. I don’t know if it was my lack of skill or some compatibility issues with the client.
Finally, I checked the github you sent me and saw the mention of python-dotenv, so I tried to use that and that solved the issue. I created the .env file and added it to a google drive folder and got it to load with the function in the following screenshot.
I also got an error ( ‘Choice’ object has no attribute ‘text’) in the “punctuation_assistant(ascii_transcript)” but was able to solve it as shown in the following screenshots.
For now the code seems to be working so I’ll be solving the topic. Once again, thank you for your help and patience! I hope these screenshots might help other new players to coding AI.