0
0
Prompt Engineering / GenAIml~10 mins

Why text generation solves real problems in Prompt Engineering / GenAI - Test Your Understanding

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

Complete the code to generate a simple text output using a language model.

Prompt Engineering / GenAI
output = model.generate([1])
Drag options to blanks, or click blank then click option'
Arandom_seed
Bmax_length
Cinput_text
Dtemperature
Attempts:
3 left
💡 Hint
Common Mistakes
Using parameters like max_length or temperature instead of input text.
2fill in blank
medium

Complete the code to limit the length of generated text.

Prompt Engineering / GenAI
output = model.generate(input_text, [1]=50)
Drag options to blanks, or click blank then click option'
Amax_length
Btemperature
Ctop_k
Dnum_return_sequences
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing max_length with temperature or top_k.
3fill in blank
hard

Fix the error in the code to generate text with controlled randomness.

Prompt Engineering / GenAI
output = model.generate(input_text, max_length=50, [1]=0.7)
Drag options to blanks, or click blank then click option'
Amax_length
Bnum_beams
Ctop_p
Dtemperature
Attempts:
3 left
💡 Hint
Common Mistakes
Using max_length again or confusing with top_p.
4fill in blank
hard

Fill both blanks to create a dictionary of word counts from generated text.

Prompt Engineering / GenAI
word_counts = {word: [1] for word in output.split() if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using word instead of len(word) or wrong comparison operator.
5fill in blank
hard

Fill all three blanks to filter and transform generated sentences.

Prompt Engineering / GenAI
filtered = [sentence.[1]() for sentence in output.split('.') if 'AI' [2] sentence and len(sentence) [3] 20]
Drag options to blanks, or click blank then click option'
Astrip
Bin
C<
Dlower
Attempts:
3 left
💡 Hint
Common Mistakes
Using lower() instead of strip(), or wrong comparison operators.