Where can I find the module utils?

I am having this problem when running the code locally. It runs fine on the notebook that is provided with the lesson on line.

Looks like I need a module called “utils” and maybe something that needs to sit two levels above where my notebook is point to to satisfy

import utils



Step 1: Input passed moderation check.

AttributeError Traceback (most recent call last)
Cell In[4], line 76
73 return neg_str, all_messages
75 user_input = “tell me about the smartx pro phone and the fotosnap camera, the dslr one. Also what tell me about your tvs”
—> 76 response,_ = process_user_message(user_input,)
77 print(response)

Cell In[4], line 14, in process_user_message(user_input, all_messages, debug)
10 return “Sorry, we cannot process this request.”
12 if debug: print(“Step 1: Input passed moderation check.”)
—> 14 category_and_product_response = utils.find_category_and_product_only(user_input, utils.get_products_and_category())
15 #print(print(category_and_product_response)
16 # Step 2: Extract the list of products
17 category_and_product_list = utils.read_string_to_list(category_and_product_response)

AttributeError: module ‘utils’ has no attribute ‘find_category_and_product_only’
</error message>

Hi Mho_Salim,

Go to File → Open and download utils.py from there.

The sys.path.append(‘…/…’) is probably there to protect the openai api key. You can just use your own key.

1 Like