CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Working with Llama 3

Afficher le cours

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.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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)
Modifier et exécuter le code