Single-turn conversation
Time to give your Conversation
class a go! You'll use this class to create a travel recommendation chatbot, that takes a description or specification of what you're looking for, and the model returns a location.
The Conversation
class you created in the previous exercise is still available with the following methods:
__init__(self, llm: Llama, system_prompt='', history=[])
create_completion(self, user_prompt='')
This exercise is part of the course
Working with Llama 3
Exercise instructions
- Instantiate an
Conversation
class with theinstruction
defined and the pre-loadedllm
. - Send a prompt to the model to get a travel recommendation (feel free to add your own prompt here).
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
instruction = "You are a travel expert that recommends a travel destination based on a specification. Return the location name only in City, Country form."
# Define a chatbot using the Conversation class
chatbot = ____(llm, system_prompt=____)
# Send a prompt to the model
result = chatbot.____("I'd like to learn about the Aztecs.")
print(result)