0
0
Prompt Engineering / GenAIml~10 mins

Chatbot development basics in Prompt Engineering / GenAI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize a chatbot model using a pre-trained transformer.

Prompt Engineering / GenAI
model = [1]('gpt-3.5-turbo')
Drag options to blanks, or click blank then click option'
Ainitialize
BChatbotModel
Ctransformer
Dload_model
Attempts:
3 left
💡 Hint
Common Mistakes
Using a class name instead of a function to load the model.
Using an undefined function like 'initialize'.
2fill in blank
medium

Complete the code to generate a response from the chatbot given a user input.

Prompt Engineering / GenAI
response = model.[1](user_input)
Drag options to blanks, or click blank then click option'
Afit
Btrain
Cgenerate
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'train' or 'fit' which are for model training, not response generation.
Using 'predict' which is common in ML but less typical for text generation.
3fill in blank
hard

Fix the error in the code to correctly preprocess user input by converting it to lowercase.

Prompt Engineering / GenAI
processed_input = user_input.[1]()
Drag options to blanks, or click blank then click option'
Alower
BtoLowerCase
Clowercase
Ddowncase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lowercase' which is not a method.
Using JavaScript style 'toLowerCase'.
4fill in blank
hard

Fill both blanks to create a dictionary that maps user intents to responses.

Prompt Engineering / GenAI
responses = { [1]: 'Hello!', [2]: 'Goodbye!'}
Drag options to blanks, or click blank then click option'
A'greeting'
B'farewell'
C'hello'
D'bye'
Attempts:
3 left
💡 Hint
Common Mistakes
Using response words as keys instead of intent names.
Using informal keys like 'hello' or 'bye' which are less clear.
5fill in blank
hard

Fill all three blanks to filter user messages that contain the word 'help' and convert them to lowercase.

Prompt Engineering / GenAI
filtered = [msg.[1]() for msg in messages if '[2]' in msg.[3]()]
Drag options to blanks, or click blank then click option'
Alower
Bhelp
Clowercase
DHelp
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lowercase' which is not a valid method.
Checking for 'Help' with uppercase H which misses lowercase matches.