Where is my order?: AI Engineering, story 9
HM Nayem asks about a parcel. The answer is in no help page and the model cannot know it. Watch how it gets it anyway.
The model can't look anything up; it asks, and the shop's code does it.
The story, step by step
HM Nayem asks about a parcel
HM Nayem wants to know where order 4821 is. The answer is not in any help page. It is a live fact, sitting in the shop's orders database, and it changes by the hour.
The model cannot know
Asked directly, the model does what it always does: it predicts something that sounds right. And searching the help pages would not help either. Nobody wrote down where this parcel is.
Tell it what it may ask for
So the server adds something new to the prompt: a description of a tool. Not the tool itself. Just its name, what it does and what it needs. Think of it as a menu the model may order from.
What a tool really is
A tool is nothing exotic. It is an ordinary function the shop's programmers already wrote, the same one the shop's website uses. The model never sees this code. It only sees the short description on the menu.
The model asks instead of answering
This time the model does not answer. It replies with a request: please run lookup_order for 4821. That reply is only text in a fixed shape. Nothing has been looked up yet.
The server checks first
Before running anything, the server checks the request like any other. Is this a real tool? Is the order number valid? Does order 4821 belong to the person asking? The model's request is a suggestion, never a command.
The server does the work
Only now does anything real happen. The model cannot touch the database. The shop's server runs the lookup itself, against its own data.
Everything is sent again
The model has no memory, so the server sends the whole exchange again: the question, the model's own request, and now the result at the end.
Now it can answer
With real data in front of it, the model writes the answer and it streams back to HM Nayem. Two calls to the model, with one lookup in between.
Who is in charge
This split matters. The model decides what would help. The server decides whether it happens. That is what makes it safe to offer tools that change things, like issuing a refund.
Now at real speed
Here is the whole trip, as fast as it really happens. This is the moment a chatbot stops guessing and starts knowing. It is called tool calling.
The model asks. The shop's code acts.
- Live facts are in no document, so the model has to ask for them.
- The server describes its tools in the prompt, like a menu.
- The model replies with a request to use one, and the server runs it.
- The result is sent back in a second call, and only then comes the answer.
Ideas in this story
- Tool calling: The model cannot do anything itself. It asks your code to, and your code answers.