I’m getting the following when I execute C1M3 Exercise 2. Failed test case: reflection_and_rewrite raised NameError with raw text: name ‘reflection’ is not defined.
Expected: no exception
Got: name ‘reflection’ is not defined
My prompt definitely has ‘reflection’ in it but isn’t it defined in the given code at the end “return {
“reflection”: str(data.get(“reflection”, “”)).strip(),
“revised_report”: str(data.get(“revised_report”, “”)).strip(),
}”
I think the unittest is in particularly looking for you to include an “reflection” and “revised_report” as text format in the user prompt you have created.
As you already shared in the return function the reflection and revised_report is an string object that gets the information from the data.get, user prompt needs to include the
“reflection” and revised_report as string text format, I leave it to you how you will create this in user prompt as string object for text format would look something like (say I am writing an essay and then summarizing in text format)
{{ “essay”: “text”, “summary”: “text” }} as these two will act as keys to get the necessary information with your user prompt when the response code invokes the gpt response.
So make sure before you mention Guidelines, mention this formatting in the user prompt.
Just in case this helps someone. Feel free to add additional cells to troubleshoot the function with print statements. In my case , I was seeing the same error , but the error was upstream in the actual request.