openai.Audio / openai>=1.0.0

I was following the course but looks like the recent API changes are causing an error with the youtube transcription. Would someone be able to let me know what adjustments are required?

You tried to access openai.Audio, but this is no longer supported in openai>=1.0.0

url=“https://www.youtube.com/watch?v=jGwO_UgTS7I
save_dir=“docs/youtube/”
loader = GenericLoader(
YoutubeAudioLoader([url],save_dir),
OpenAIWhisperParser()
)
docs = loader.load()

Hi @dugmanstar,

Are you trying to run this locally or in the platform ?

And can you tell me which lesson is this ?

Thanks,
Mubsi

I face the same issue too. the lesson is here: https://learn.deeplearning.ai/langchain-chat-with-your-data/lesson/2/document-loading

I run the script on my personal Google Colab notebook with my OpenAI API Key already specified.

my code is as follow:

from langchain.document_loaders.generic import GenericLoader
from langchain.document_loaders.parsers import OpenAIWhisperParser
from langchain.document_loaders.blob_loaders.youtube_audio import YoutubeAudioLoader

url="https://www.youtube.com/watch?v=AmeztiIW6P8"
save_dir="content/youtube/"
loader = GenericLoader(
    YoutubeAudioLoader([url],save_dir),
    OpenAIWhisperParser()
)
docs = loader.load()

Hi @davidcung,

These courses are designed to run in the platform, where the libraries are frozen.

When you run this in colab, you are running it with the latest libraries where you can expect that syntax might be different.

You can either figure out the new syntax, or use the same library versions as used in the platform.

Best,
Mubsi

Ah! no wonder. Thanks @Mubsi! Is there a way to extract the versions of the packages used in said notebook so that I can replicate them in my local machine? I tried entering the following at the end of the “Youtube” section and received the following output.

!pip freeze > requirements.txt
print(open('requirements.txt','r').read())

Output:

gyp==0.1
mercurial==6.3.2
six==1.16.0