Print_llm_response is not a built-in function

I am new here. I was trying the extra exercises in week 1 of AI Python for Beginners. I was getting the error message “print_llm_response” is not a built-in function. The code did run on my AI platform - Google Gemini.

Just want to know if I was doing something wrong here.

Thanks a lot for your help

To run the assignments locally, you have to download all of the assets that the assignment uses. You can find them in the File menu.

You may also have problems if the version of your AI tools does not match the ones that DL.AI used in creating the assignment.

This can be a difficult problem to resolve.

Hi TMosh,

Thanks a lot for your response.

I ma having the same problem with Week 2 Assignment. Pls see below the error message I got

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [5], line 2
      1 # Test your code!
----> 2 test_your_code.exercise_1a(book_title, author, year_published, available_copies)

NameError: name 'available_copies' is not defined

I ran the same code in my AI platform - Google Gemini - and the code ran well.

Will greatly appreciate your help on how to fix this problem for me to be able to proceed. I cannot see any set of instructions on how to download the all of the assets that the assignment uses. How do I alos check if the version of my AI tools matches the ones that DL.AI used in creating the assignment.

Thanks a lot for helping out.

There are no instructions for this because:

  • You’re expected to run the assignments on the DL.AI platform.
  • There are too many other platforms available for DL.AI to provide instructions for all of them.

Regarding your specific error with “available_copies”, I have not yet attempted this course myself, but I’ll take a run at it later this evening. I might be able to give an answer later.

Hi @Faks,

Regarding your first query:

Could you be more specific, which lesson, notebook, exercise you are referring to here?

Regarding your second query:

You very likely did not use the variable name available_copies, in the previous cell. Please ensure you using available_copies . Or maybe check if you made a typo in the previous cell when initialising this variable.

Let me know.
Mubsi

Another possibility is that you simply didn’t execute the cell that defines available_copies. You need to run every previous cell first. And note that you need to rerun them anytime you reopen or restart the notebook. If you just leave it open for more than single digit minutes, the “kernel” shuts down and you need to restart the notebook and rerun all the cells.

The easy way to test my theory would be:

Kernel -> Restart and Clear Output
Cell -> Run All

If that makes the problem go away, then it means the cell that creates that variable had not been run since the last time the kernel was restarted.

But if it still fails in the same way (variable not defined), then you need to check the points that Mubsi listed above.

Hi @Mubsi thanks a lot. I reset my notebook and the code now ran well. Thanks a lot for all your help. Greatly appreciate it

Hi @paulinpaloalto thanks a lot. I did as you you suggested but the code did not run. I reset my notebook and started all over again and the code now ran. Thanks a lot for all your help. Greatly appreciate it.

Hi @TMosh I reset my notebook and started all over again and the code now ran. Thanks a lot for your help. Greatly appreciate it.

That’s good news.