I am having trouble getting C1M2 submitted on the Coursera platform. I received the message that “all tests passed”, and when I got to the end, I restarted and cleared the output and re-checked all the code. Again, I received “all tests passed.” I saved the file and submitted, and then received a zero. I have tried submitting 3 times. The error message I receive from the grader is “There was a problem compiling the code from your notebook, please check that you saved before submitting. Details:
name ‘get_llm_response’ is not defined.” I did run the import get_llm_response at the bottom prior to running the code in part 5. Would you kindly take a look at this and let me know how to resolve this issue? Thanks, Marti
this error name get_llm_response is not defined usually means the grader cannot find where the function is written. even if it works for you the grader runs everything from the start
please try these steps
1 check if you deleted any cells by mistake
2 do not move the imports or code to the bottom. keep everything in its original place
3 the best fix is to get a fresh copy of the lab. go to help then lab help and click get latest version
4 copy your work into the new notebook and submit again
this should fix the compiling problem. let me know if you need more help
In simple words, the grader is not suppose to be passed the function “get_llm_response”. You have added code that is not suppose to be added in the exercise code cells.
The notebooks are designed in a certain way with intention, and they should be attempted as per the instructions for each exercise. Do not add any code that is not part of the instructions.
So wherever you added the extra “get_llm_response” code lines, please remove them, and try submitting again.
I got a fresh copy of the lab by getting the latest version, copied in the work, and “all tests passed.” Followed the instructions to clear the output, re-ran it from the top, and all tests passed again. I resubmitted the assignment and again received a zero. I am completely baffled as to why this is happening. I did not delete any cells or add any code not requested by the assignment. The grader feedback is below. One thing I wanted to point out is that the import get_llm_response is not at the top of the assignment along with the other import as one would expect. When you get to section 5 of this lab, it requests we use the get_llm_response but up until that point the import get_llm_response hasn’t been provided to us. The import get_llm_response can be found at the very bottom of the lab after the submission instructions. I did import it prior to running my code but wanted to mention this in case this is causing problems. Any assistance or guidance you can provide would be greatly appreciated!
Exercise 1
Filename: Exercise 1
0/10Score: 0 of 10
Hide grader output
Grader output
There was a problem compiling the code from your notebook, please check that you saved before submitting. Details:
name ‘get_llm_response’ is not defined
thank you for the detailed update. your observation about the import being at the bottom is very important.
please try this one last thing to fix the grader flow
1 find the line import get_llm_response at the bottom of your lab.
2 copy it and paste it into the very first code cell at the top of the notebook.
3 make sure you are only using this function where the instructions explicitly ask for it as @Mubsi mentioned. do not add any extra code inside the exercise blocks that is not requested.
4 run all cells from top to bottom then save and submit.
if this still gives a zero please share a screenshot of the specific cell where you use get_llm_response so we can see if there is a syntax issue.
I failed to mention that copying the import get_llm_response up to the top was the first thing I tried, but it will not let me paste any code in that first line with the other import. Below is where the get_llm_response is utilized in the assignment per your request.
In the version of the assignment that I have, the end of Exercise 5 is predefined as “print(prompt)”, rather than “print(get_llm_response(prompt))”. You may have accidentally added this to the code. I think reverting back to “print(prompt)” in this part of the module should resolve the issue. The “get_llm_response” portion of the assignment is optional and is only imported after the prompt itself has been defined. Please let me know if this helps.