Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to call the function that generates text from a prompt.
Prompt Engineering / GenAI
response = generate_text([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a number instead of a string.
Passing None instead of a string.
Passing the function name itself instead of a string.
✗ Incorrect
The function generate_text expects a string prompt as input, so passing "Hello, world!" is correct.
2fill in blank
mediumComplete the code to call the function with the correct keyword argument for temperature.
Prompt Engineering / GenAI
result = generate_text(prompt="Hi", [1]=0.7)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'temp' instead of 'temperature'.
Misspelling 'temperature' as 'tempurature'.
Using a non-existent keyword like 'temp_value'.
✗ Incorrect
The correct keyword argument for controlling randomness is 'temperature'.
3fill in blank
hardFix the error in calling the function to generate text with max tokens set to 50.
Prompt Engineering / GenAI
output = generate_text(prompt="Test", max_tokens=[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing max_tokens as a string "50".
Passing a word like 'fifty' instead of a number.
Passing None instead of a number.
✗ Incorrect
max_tokens expects an integer, so 50 without quotes is correct.
4fill in blank
hardFill both blanks to call the function with prompt and stop sequence arguments.
Prompt Engineering / GenAI
response = generate_text(prompt=[1], stop=[2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using None for prompt or stop.
Using 'END' as stop when newline is expected.
Passing prompt without quotes.
✗ Incorrect
The prompt should be a string like "Hello" and the stop sequence is often a newline character "\n".
5fill in blank
hardFill all three blanks to call the function with prompt, temperature, and max_tokens.
Prompt Engineering / GenAI
result = generate_text(prompt=[1], [2]=0.9, [3]=100)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'prompt' as a keyword argument again.
Passing temperature or max_tokens as strings.
Not quoting the prompt string.
✗ Incorrect
The prompt is a string, and the keyword arguments are 'temperature' and 'max_tokens'.