Start studying
Module 7 · Prompt Engineering Module contents
Module 7  ·  Card 15 / 17beginner

Tool Calling

Tool calling lets a model invoke functions you define.

You describe each tool with a name, purpose and parameter schema.

The model decides when to call one and produces the arguments.

Your code runs the tool and returns the result into the conversation.

This is how models reach live data, do exact arithmetic and take real actions.

Learn in depth ↓
Module 07 · Prompt Engineering · 17 concepts
In depth  /  15 lines

Tool Calling, in more detail

Tool calling lets the model use functions you provide instead of answering from memory.

You describe each tool with a name, a purpose and a parameter schema.

The model decides when one is needed and produces the arguments to call it with.

It never runs anything, since your code receives the request and executes it.

The result is passed back and the model continues with that information in hand.

This is how a model reaches live data, does exact arithmetic and takes real actions.

It converts a text generator into something that can affect the world, which is the point of agents.

The description is the whole interface, so a vague one produces a badly chosen tool.

Write it for a competent stranger, saying when to use it and when not to.

Fewer tools works better, and beyond roughly twenty selection quality falls off.

Parameter descriptions matter as much as names, especially for formats such as dates.

Validate every argument before executing, because the model can produce plausible nonsense.

Never let a tool take a destructive action without a check outside the model.

Return errors as readable text, since the model can often correct itself and retry.

Everything a tool returns is untrusted input and can carry an injection.

Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
In tool calling, who actually runs the tool?
Prompt Engineering

17 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close