Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to call a function named 'get_weather' using the LLM's function calling feature.
Agentic AI
response = llm.call_function('[1]')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name unrelated to the task, like 'send_message'.
Forgetting to use the exact function name as defined.
✗ Incorrect
The function 'get_weather' is the correct function to call for retrieving weather information.
2fill in blank
mediumComplete the code to specify the function parameters for 'get_weather' with a location argument.
Agentic AI
params = {'location': '[1]'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated terms like 'temperature' as the location value.
Passing the entire weather data instead of a location name.
✗ Incorrect
The parameter 'location' should be assigned a city name to specify where to get the weather.
3fill in blank
hardFix the error in the function call by correctly passing parameters to 'call_function'.
Agentic AI
response = llm.call_function('get_weather', [1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the function name again instead of parameters.
Passing a single string instead of a dictionary.
✗ Incorrect
The function 'call_function' expects parameters as a dictionary, which is stored in 'params'.
4fill in blank
hardFill both blanks to extract the temperature from the response dictionary.
Agentic AI
temperature = response[1]'data'[2]'temperature'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using dot notation which does not work for dictionaries.
Using invalid operators like '->'.
✗ Incorrect
To access nested dictionary values, use square brackets with keys as strings.
5fill in blank
hardFill all three blanks to define a function schema for 'get_weather' with a required 'location' parameter.
Agentic AI
function_schema = {
'name': '[1]',
'parameters': {
'location': {'type': '[2]', 'required': [3]
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function names.
Setting 'required' to False when it should be True.
Using wrong parameter types.
✗ Incorrect
The function name is 'get_weather', the parameter type is 'string', and it is required (True).