建立對話
你正在使用的 Llama 模型可以接受來自不同角色的訊息作為提示。在這個練習中,你會建立訊息來提示一家網路服務供應商的客服聊天機器人。
Llama 模型已經以 llm 提供。
本練習屬於課程
使用 Llama 3
練習說明
- 在
conv清單中補齊對話,將作為prompt提供的"user"訊息包含在內。 - 將整段對話傳給 Llama 模型
llm,並印出結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
prompt = "Give me four short steps to troubleshoot my internet connection."
conv = [
# Complete the user message
{
"role": "____",
"content": ____
}
]
# Pass the conversation to the model
result = llm.create_chat_completion(messages=____, max_tokens=20)
print(result)