Why does the latest OpenAI (4.25.0) throw a "! Error: Unknown Error"?

In the Scrimba environment, just importing OpenAI@4.25.0 throws the unknown error. 4.17.4 and 4.19.1 work as expected. I wouldn’t care so much but I can’t seem to figure out how to get the documentation of previous versions. Does anyone know how to fix this?

Hi @Brock
I am not 100% sure why this is happening but will tag @frode and see if he can help.

In terms of documentation, is there something you are trying to do with 4.25.0 that can’t be done or would be done differently with 4.19.1?

@Brock When you get this error, can you check if anything gets logged out in your browser developer console too? There could potentially be some more information about what the error entails there since our scrim sometimes abstracts errors.

The “Error: Unable to resolve specifier ‘openai’ imported from https://cw19.scrimba.com/index.js” is new.

To tell the truth, Learn AI Agents p25 didn’t explain the syntax of automatic function calls all that well. Bob explained what he was doing by passing in the obj as a parameter to getCurrentWeather, but I have no idea how to do anything other than that. I’m trying to call the open movie data base API with a single parameter of a string. What do I do with the properties part of the function? The documentation for 4.26(!).0 doesn’t help much.

Also, I would like to figure out streaming assistants rather than polling. The workaround that Guil used seems to work, but the new docs don’t even mention polling now.

Tried with 4.26.0. No difference.

Thanks for the information, Brock. Tagging @frode and also @bobziroll here for reference to see if they have insight on what can be going on. Not too sure what the cause of this is.

Yes, similar issue here. I found the solution:
Add a dependency in the Dependencies on the left side and make it an earlier version e.g.:
openai@14.4.2.

With the demo apikey as well, users most likely will not have access to gpt-4 or beyond gpt-4-turbo etc.
Therefore if model: ‘gpt-4’ throws an error, try the below and you can continue as per the lessons.

const response = await openai.chat.completions.create({
model: ‘gpt-3.5-turbo’,
messages: messages
})

It’s a fast moving development, hence, I can understand why what worked yesterday, will have some more explanation needed today.

Not sure if any update needs to be done in the backend to make the Scrimba UI compatible with the latest versions, however, please find the recommendation I have given for anyone coming across this issue. Maybe good to clarify in the course as well.

The way to do it:

  1. Next to dependencies there is … click on it.

  2. Then press “add modules”

  3. Enter “openai@4.14.2” in the input box and press add

  4. You should see the below:

image

  1. Run your query again.

Alternatively, the queries can be copied over to an IDE to replicate (what I tried to do first).
However, the above should work and should keep you in the Scrimba experience like it does for me.

1 Like

Thanks @Jeffrey. We did notice the dependency bugs with some of these lessons lessons. We’ve got a ticket on this and it’s being worked on for our new system update. Hopefully once we fully migrate to the new Scrimba version the problem doesn’t continue.

Noted, that sounds good!