Tool Use (Function Calling)
Definition
Tool use, also called function calling, lets a language model ask the application to run a defined function, such as a search, a database query or a calculation, and then use the result in its answer. The model chooses the tool and its inputs; the application runs it.
How a tool call works
- Describe the toolsThe app tells the model each tool's name, purpose and inputs.
- The model asksIt replies with a structured request to call a tool, instead of an answer.
- The app runs itThe app checks the request, calls the real system and returns the result.
- The model answersIt writes its reply from the result, or asks for another tool.
Diagram
- Person
Where is my order 1042?
- Model → app
call get_order_status { "order_id": "1042" }Not an answer yet: a structured request
- App → model
{ "status": "shipped", "carrier": "DHL", "eta": "Thursday" }The app ran the real lookup
- Model → person
It shipped with DHL and should arrive on Thursday.