chapter thirteen

13 Tool Use & Function Calling

 

This chapter covers

  • How models are trained to use tools
  • Why tools mitigate structural weaknesses of language models
  • What to consider when giving your model tools

Language models using tools is a natural way to expand their capabilities, especially for high-precision tasks where external tools contain the information or for agents that need to interact with complex web systems. Tool-use is a skill that language models need to be trained to have, where RLHF and all the other methods presented in this book can refine it. Consider a question from a user such as:

Who is the president today?

A language model without tools will have a hard time answering this question due to the knowledge cutoff of pretraining data, but this is readily accessible information with one search query. Consider another example:

Move all the arXiv papers in my downloads folder to my ~/research/ directory with names indicating the date of the paper.

This is a task that the model weights alone cannot even attempt – the use of tools enables language models to address a far broader range of tasks.

Before diving deeper, it is useful to distinguish related terms that are often used interchangeably:

13.1 Interweaving Tool Calls in Generation

13.2 Multi-step Tool Reasoning

13.3 Model Context Protocol (MCP)

13.4 Implementation Details

Summary