I have a Miniforge installation on my laptop. I could not find the helper_functions library in my computer. I browsed through this community and also the web. Most of the links do not work. I could not find it even the github repository of deeplearning.ai. Can one help me find the right file and advise how to install it.
Thanks,
Dear @Girijesh
After much struggle, I downloaded the helper_functions.py from the relevant Github repository of deeplearning.ai, and put it in the same folder where miniforge installed all its libraries (like numpy etc). But the code âfrom helper_functions import print_llm_respLonseâ is getting the below response:
"---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from helper_functions import print_llm_respLonse
ModuleNotFoundError: No module named âhelper_functionsâ
I meant that I think helper_functions.py should be in the same folder that the .ipynb file is saved in. I presumed you are working on an assignment, with a .ipynb extension. I do not see an .ipynb file in the directory you listed, which is why I think they are not in the same folder.
But my question to you is, if you are correct, then no one can run their helper_fucntions.ai outside deeplearningâs environment, right? Nobody will have the file! But many people seem to have. And why would deeplearning.ai not equip its students to run these in their local enviroment, but only from theirs?!
I believe others have found where that file is stored in the course assignments. Itâs a popular topics on the discussion forum. Have you tried doing a forum search for the file name?
The file is correct.
I figured out that it needed to be in the Lib folder under miniforge3 folder. Some google research helped it.
But then it cannot execute the module because it misses some more libraries/ modules.
The opening codes are:
#import gradio as gr
import os
from openai import OpenAI
from dotenv import load_dotenv
import csv
@TMosh
The answers to your implied question in the sentence âI believe others have found where that file is stored in the course assignments. Itâs a popular topics on the discussion forum.â - could be two.
They are not a 58 year old newbie who is trying to learn stuff that he has not done in his life.
They are not trying to use the function in their local environment
Anyway, I will persevere in finding a solution, although I donât need to. Itâs a skinny course on python and does not introduce a lot of basic concepts. But I will complete it and also will find a solution to this niggling problem.
In Module 4, there is a lab called âInstall Python on your computer (optional)â which discusses setting up your own environment and getting API keys.
Regarding files such as helper_functions.py, they tend to be available from Lab Files, near the upper right-hand corner of the page of the relevant assignment on Coursera. You can download them more easily from there.
Anyway, I have found most of the answers myself. At the cost of a lot of time!
But it will be great to check at the end of the course to see if I did exactly the same as what they suggest.
Thanks again, all.
As @TMosh mentioned, our (DL.AI) courses donât have public repositories for majority of our courses, especially not for AI Python for Beginners, so Iâm keen to know from which repository you got the code from. Can you share that?
Chances are, you might have gotten it from a repository which someone else created using our course material, which is very common.
As others have instructed you, and to answer this:
The only way you can download these files in an official manner is:
If you are taking the Course on Coursera:
Open the lab you want the files for, and on the top right corner, click, Lab files:
When the panel opens, you can either click on Download all files or select the file you want to download.
If you are taking the Course on our website:
Open the notebook.
After the notebook opens up, click File â Open.... Depending on your view, it could be Menu --> File --> Open...
After the workspace opens up, click the checkbox next to the notebook, it will then show you a Shutdown option, click that. This will turn your notebook icon from green to grey.
Next, click the checkbox next to the notebook again, and now youâll see the Download option.
Similarly, steps 1, 2, 4 can be used to download any other file as well.
Once downloaded, all of the relevant files need to be in the same place/folder/directory as the notebook file in order for the notebook to run as it is. And of course, you need to add your own OpenAI API key, as instructed, in the helper_functions.py file to be able to use those functions.
Looks like I found them in a repository created by someone else. I am not able to find it again. But if and when I find it, I will share with you.
In my latest attempt (after installing OpenAI and dotenv through conda install), I got this error message:
OpenAIError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from helper_functions import print_llm_response, get_llm_response
File C:\ProgramData\miniforge3\Lib\helper_functions.py:13
10 openai_api_key = os.getenv(âOPENAI_API_KEYâ)
12 # Set up the OpenAI client
â> 13 client = OpenAI(api_key=openai_api_key)
16 def read_csv_dict(csv_file_path):
17 âââThis function takes a csv file and loads it as a dict.âââ
File C:\ProgramData\miniforge3\Lib\site-packages\openai_client.py:116, in OpenAI.init(self, api_key, organization, project, base_url, websocket_base_url, timeout, max_retries, default_headers, default_query, http_client, _strict_response_validation)
114 api_key = os.environ.get(âOPENAI_API_KEYâ)
115 if api_key is None:
â 116 raise OpenAIError(
117 âThe api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variableâ
118 )
119 self.api_key = api_key
121 if organization is None:
OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
As you can see in the name of the repo, annoyingCode/deeplearning-ai-short-courses, this is a repository made by someone called annoyingCode, and is not ours.
For future reference, unless specifically mentioned in our course, we donât have public repos for any of them.