Generative AIby Dhruv Narang

1. Have You Seen This?

You ask ChatGPT for today's Bitcoin price. It says "Searching the web…" and then answers. Where did that answer come from?

chatgpt.com
What is the Bitcoin price right now?
Source 1Source 2Source 3
Bitcoin is trading at about $67,000 right now. (example)
+Ask anything↑
How did it know? The model was not trained on today's price.

2. The Model Does Not Know This

A model learns from text up to a cutoff date. Nothing after that is inside it. Weather, Bitcoin and stock prices change every minute.

Training data
Everything after the cutoff is missing
Cutoff
Today
Weatherchanges every hournot in the model
Bitcoinchanges every secondnot in the model
Stock priceschange every minutenot in the model
Today's newshappened after the cutoffnot in the model

3. So How Does It Answer?

It asks us to fetch the data from a third-party API. The helper that does this is called a tool.

You
→question
←answer
LLM
→asks for the tool
←tool result
Toola Python function
→calls the API
←data
Third-party APIweather, crypto, search

4. What Is a Tool?

Definition

A tool is a Python function the LLM can ask us to run. The LLM never runs it. Our code does.

LLMDecides
"I do not know today's Bitcoin price. I need a tool."
It asks for
get_price("bitcoin")
→asks
←result
Our codeRuns
Runs the function. It calls a crypto API and gets the price.
It sends back
$67,000
Example. The function name get_price is made up for this picture.