As the process user message in the video ( not the code in notebook) it appears:
# Step 4: Answer the user question
step_4_system_message = utils.step_4_system_message
step_4_messages =[step_4_system_message] #No le suma all_messages ????
step_4_messages += all_messages #step_4_messages = [step_4_messages] + all_messages ???
step_4_user_message_and_product_info = [
{'role':'user', 'content': f"{user_input}"},
{'role':'assistant', 'content': f"Relevant product information:\n"} #Aqui duda product_info}
]
step_4_messages += step_4_user_message_and_product_info
all_messages += step_4_user_message_and_product_info
step_4_response = get_completion_from_messages(step_4_messages)
if debug: print("Step 4: Generated response.")
but i think this code is little clearer:
# Step 4: Answer the user question
step_4_system_message = utils.step_4_system_message
step_4_messages = [step_4_system_message] + all_messages #Similar to code in step2
step_4_messages = step_4_messages + [
{'role':'user', 'content': f"{user_input}"},
{'role':'assistant', 'content': f"Relevant product information:\n"} #Aqui duda product_info}
]
all_messages = all_messages + [
{'role':'user', 'content': f"{user_input}"},
{'role':'assistant', 'content': f"Relevant product information:\n"}
]
step_4_response = get_completion_from_messages(step_4_messages)
if debug: print("Step 4: Generated response.")
My doubts:
1 - The two code are the same or im missing something? I tried to simplify to my understanding and following the logic of step2.
2 - Why all_messages is used ? It doesnt do anything…also in the code of the function in the notebook, they pass all_messages as parameter with but in the video it doesnt even use it. So this param in video code is useless.
3 - Why you use step_4_user_message_and_product_info in the code:
step_4_user_message_and_product_info = [
{'role':'user', 'content': f"{user_input}"},
{'role':'assistant', 'content': f"Relevant product information:\n"} #Aqui duda product_info}
]
step_4_messages += step_4_user_message_and_product_info
all_messages += step_4_user_message_and_product_info
following the logic should be something similar in step2 and you only add
step_2_messages = step_2_messages + [
{'role':'user', 'content': f"{delimiter}{user_input}{delimiter}"},
]
So id prefer something like:
step_4_messages = step_4_messages + [
{'role':'user', 'content': f"{user_input}"},
{'role':'assistant', 'content': f"Relevant product information:\n"} #Aqui duda product_info}
]
all_messages = all_messages + [
{'role':'user', 'content': f"{user_input}"},
{'role':'assistant', 'content': f"Relevant product information:\n"}
]