0
0
Agentic AIml~10 mins

Function calling in LLMs in Agentic AI - 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 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'
Aget_weather
Bprocess_input
Csend_message
Dfetch_data
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.
2fill in blank
medium

Complete 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'
Acity_name
Btemperature
Cweather_data
Dforecast
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.
3fill in blank
hard

Fix 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'
Alocation
Bparams
Cget_weather
Dweather_response
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the function name again instead of parameters.
Passing a single string instead of a dictionary.
4fill in blank
hard

Fill 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'
A[
B]
C.
D->
Attempts:
3 left
💡 Hint
Common Mistakes
Using dot notation which does not work for dictionaries.
Using invalid operators like '->'.
5fill in blank
hard

Fill 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'
Aget_weather
Bstring
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function names.
Setting 'required' to False when it should be True.
Using wrong parameter types.