Lesson 9 of 30
The model never runs code — it asks your code to run something and hands back a request. Everything people call 'the AI checked the weather' or 'the AI queried the database' is this one mechanism underneath.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A model requests a tool call with arguments that don't match the tool's expected schema (e.g. a string where a number was required). What's the correct way to treat that request?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
A model can only generate text. It has no way to reach out to a database, call a weather API, or execute a calculation on its own — those capabilities don't exist inside the model. Function calling (also called tool use) is the mechanism that bridges that gap, and it works entirely through structured text, not through the model gaining any new capability.
Here's the actual sequence:
getWeather with { city: 'Austin' }."The model's only role is deciding which tool to call and with what arguments, based on the tool descriptions you gave it — it's still just generating text, but that text happens to be a structured call request instead of a direct answer. Everything people describe as "the AI can check the weather" or "the AI can query a database" is this loop, not the model reaching outside of itself.
A user asks a question the model can't answer from text alone: 'What's the weather in Austin?'
// 1. Tool definition you give the model
{
"name": "getWeather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
// 2. Model's response isn't an answer — it's a call request
{ "tool": "getWeather", "arguments": { "city": "Austin" } }
// 3. Your code executes getWeather("Austin") — this runs in YOUR
// environment, with your API keys, your network access, your rules
// 4. Result sent back to the model as part of the conversation
{ "tool": "getWeather", "result": { "tempF": 91, "condition": "sunny" } }
// 5. Model's final response, now grounded in a real result
"It's 91°F and sunny in Austin right now."
Step 3 is the part worth sitting with: your code decides whether to actually run that function, with what permissions, and against what real systems. The model requesting a call is not the same as the call happening — a well-built integration validates the arguments the model produced before executing anything, the same way you'd validate any other untrusted input, because the model can request a call with malformed or unexpected arguments.
"How does an AI assistant actually check the weather or query a database?" tests whether a candidate understands that the model requests, your code executes, and the result comes back — versus the common misconception that the model somehow reaches out and does it directly.