MulaiMulai sekarang secara gratis

Building a conversation

The Llama model you've been working with can accept prompts in the form of messages from different roles. In this exercise, you'll create messages to prompt a customer support chatbot for an internet service provider.

The Llama model is available as llm.

Latihan ini adalah bagian dari kursus

Working with Llama 3

Lihat Kursus

Petunjuk latihan

  • Complete the conversation in the conv list so it includes the "user" message provided as prompt.
  • Pass the conversation to the Llama model, llm, and print the result.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

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)
Edit dan Jalankan Kode