Which statement best describes the purpose of function calling in AI tools?
Think about how AI can interact with external systems or APIs.
Function calling lets AI request specific tasks or data by invoking predefined functions, enabling dynamic and controlled interactions.
What is the output of the following function call simulation in an AI tool?
def get_weather(city): return f"The weather in {city} is sunny." result = get_weather('Paris') print(result)
Look at the function return string and the argument passed.
The function returns a string with the city name inserted. Since 'Paris' is passed, the output includes 'Paris'.
You want an AI tool to fetch the current stock price for a company. Which function call is most appropriate?
Focus on the function that retrieves stock price information.
The function fetch_stock_price is designed to get the current stock price given a company symbol, which matches the task.
When calling a function to generate text with an AI model, which parameter controls the randomness of the output?
Think about which parameter affects creativity or randomness in generated text.
The temperature parameter controls randomness: higher values produce more random outputs, lower values make output more predictable.
Given this function call in an AI tool, what error will it raise?
def get_user_info(user_id: int): return {'id': user_id, 'name': 'Alice'} info = get_user_info('123') print(info)
Check the function parameter type and the argument passed.
The function expects an integer user_id, but a string '123' is passed, causing a TypeError in strict type checking environments.