Module 3 Lesson 1: Using files in Python Exercise 2

Not sure mentor direction

line 1: from helper_functions import get_llm_response

Exercise 2:
#get_llm_response or print_llm_response

function not import print_llm_response, the aim need us debug error problem or just complete the exercise?

I use back get_llm_response to completed

Are you passing the test, the grader tests, because if you’re passing the tests, it means that you have the required solution? I’m not completely familiar with this course.

tell me what this line for?

from helper_functions import get_llm_response

that import get_llm_response only

so on Exercise 2: should not appear print_llm_response, should correct wording , unless this exercise is test for debug

#get_llm_response or print_llm_response

Hi @PC_Services_Ltd ,

The file “helper_functions.py” contains both functions and they behave differently. The print_llm_response() prints the response from LLM, while get_llm_response() saves the response from LLM as a string. If you want to use the print_llm_resposne() function, you will need to do another import statement as this lab has so far only imported one specific function: the get_llm_response().

You can check out the code in helper_functions.py following the step below:

from the menu bar on the top of your notebook click:
file->open->helper_functions.py

I need to point out is print_llm_respond not import, why on exercise will put request ask use get_llm_response or print_llm_response.

the print_llm_reponse will not work cause from import is make the mistake

Hi @PC_Services_Ltd ,

I don’t understand what you are trying to say. If you are not sure, you can use the ‘Chat’ feature and ask LLM to clearify.

what this request for

Write code below to list all of the activities that Daniel did on

his trip. You’ll need to create a prompt and use either

get_llm_response or print_llm_response

what this line for

from helper_functions import get_llm_response

can use print_llm_response?

take full look

Hi @PC_Services_Ltd ,

What this exercise asks you to do is to write a prompt to get the LLM to look at Daniel’s email and give you information about his trip. If you use the get_llm_response() function, you will have to create a variable to store the information returned, and then print it out just like the previous code cells. If you use the print_llm_response(), you don’t need to do the extra step of printing the response, that function will include the printing step in addition to getting a response from the LLM.

However, if you use the print_llm_response(), you will need to add an import statement to import the print_llm_response() function as the first line of your code like this:

from helper_functions import print_llm_response

well, you can ignore this thread. you does not find out the issue on this exercise. I already point out the comment is confuse the reader

You can complete this exercise either using get_llm_response or print_llm_response.

I decide to do it using get_llm_response, the answer would look something like this:

prompt = f"List all of the activities that Daniel did on his trip. Trip details: {email}"

activities = get_llm_response(prompt)

print(activities)

But if you were to complete this exercise using print_llm_response, you’d first have to import the function, for which the solution could look like:

from helper_functions import print_llm_response

prompt = f"List all of the activities that Daniel did on his trip. Trip details: {email}"

print_llm_response(prompt)

The wording, Write code below to list all of the activities that Daniel did on his trip. You'll need to create a prompt and use either get_llm_responseorprint_llm_response. is correct and giving you the choice of the function you want to use.

thanks but I don’t need to choice, I closed exercise before this post.