Get startedGet started for free

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.

This exercise is part of the course

Working with Llama 3

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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 and Run Code