构建一次对话
您正在使用的 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)