Graded Exercise 5: Import Error: cannot import name 'get_phoenix_endpoint' from 'utils' (/home/jovyan/work/utils.py)

The following error is preventing from running exercise 5 from RAG class on the Deep Leearning AI site. Please note the error occurs when I try to run the second import cell in the C1M5_Assignment.ipynb file. Please advise how to remedy this problem. I really would like to complete this class as soon as possible.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[2], line 5
      3 import unittests
      4 import json
----> 5 from utils import (
      6     ChatWidget, 
      7     generate_with_single_input,
      8     parse_json_output,
      9     get_filter_by_metadata,
     10     generate_filters_from_query,
     11     process_and_print_query,
     12     print_properties,
     13     make_url,
     14     get_phoenix_endpoint
     15 )

ImportError: cannot import name 'get_phoenix_endpoint' from 'utils' (/home/jovyan/work/utils.py)

@markcberman

just heads up, as there was some issues with the labs in this course, before you start, always try to Restore original version, so you are making sure to working updated notebook.

Let me know if you are still encountering the error.

Also kindly wait, as I know why this error is happening, I am just going to file a big report as other learners have also reported this error. I thought earlier the indentation (extra! space) between import and ( is being done by learners, but I just checked the file has this extra space from beginning. For you, you just need to remove that extra space and re-run the cell to resolve that error.

Let me know if the error still exist, the post the screenshot of that import cell too for me to cross check

The problem is that the function get_phoenix_endpoint is NOT present in the utils.py file.
Just define:
def get_phoenix_endpoint():
return “http://localhost:6006/”
In a cell, and it will work

Note that in general, modifying the notebook by adding cells is not a good practice. It has a tendency to confuse the grader.

I know, but without that function the tracer won’t be set and the lab can’t be completed at all :frowning:
An alternative can be adding it to the utils.py file of course

Try the fix that Deepti_Prasad suggested, in editing the “from utils import …” statement to remove an extra space character.

Did not work, the problem is that the function itself is not present in utils.py, so it can’t be imported :frowning:

Thanks for checking that.

An issue has already been submitted to address this issue.

You are welcome, and I can confirm that the grader worked even with the extra cell, it just finished :slight_smile:

Thank you @ShinDav i think this issue must have raised because staff updated the model version, and must caused conflict with endpoints. I will inform this to staff.

Honestly I didn’t encounter any such error, when I re-did the course around 2025 christmas time.

I will update this to the staff

You are welcome, I encountered it recently too because I was redoing it myself :slight_smile:

I restored all of the files for the graded exercise for module 5 (after I made code changes to the original version). Problem was resolved but I had to redo some of my work. Please close this case.

That assignment was just updated yesterday (to fix a breaking issue), so you would have needed the new version in any case.