0
0
Prompt Engineering / GenAIml~10 mins

Tool usage (function calling) 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 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'
A12345
B"Hello, world!"
CNone
Dgenerate_text
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.
2fill in blank
medium

Complete 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'
Atemperature
Btemp
Ctemp_value
Dtempurature
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'temp' instead of 'temperature'.
Misspelling 'temperature' as 'tempurature'.
Using a non-existent keyword like 'temp_value'.
3fill in blank
hard

Fix 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'
Afifty
B"50"
C50
DNone
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.
4fill in blank
hard

Fill 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'
A"Hello"
B"\n"
C"END"
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using None for prompt or stop.
Using 'END' as stop when newline is expected.
Passing prompt without quotes.
5fill in blank
hard

Fill 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'
A"Write a poem"
Btemperature
Cmax_tokens
Dprompt
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.