Error in Custom Recipe generator

Hello, this is the error I am getting when I use the code given in the tutorials. Please help and resolve this error

Hi @prashant0410

In the latest OpenAI package the response.choices object type is changed . Kindly make the following changes in your code.

response = openai.chat.completions.create

and

return response.choices[0].message.content

This must solve your problem. We will be updating the same in the training content so that other students don’t face this issue. If you still face any issues please feel free to get back to us.

Hi @prashant0410

Thanks for pointing out the issue in the code.

In the latest OpenAI package the response.choices object type has changed. We have also made the necessary changes in our Training content as well so that other students don’t face this issue.

@prashant0410 Did the above code update solve your issue? Do let us know if you are still facing an issue and share your code as well along with the error.

Great Thanks it Helpful.

Great Thanks it Helpful.