Since message.get("location") returns None, the argument is not set to the expected value.
This is because location is a child of arguments, not message.
However, since this parameter is not used, the code can be executed without problems.
# Step 3, call the function
# Note: the JSON response from the model may not be valid JSON
function_response = get_current_weather(
location=message.get("location"),
unit=message.get("unit"),
)
I have also tested whether so the answer of the AI also mentions Boston and indeed the following answer comes:
‘The current weather in Boston is sunny and windy with a temperature of 50 degrees.’
This apparently results from the question of what the weather is like in Boston. Although the return value for the location is None, Boston is assumed.