Skip to content
Optimal Lab

AI native · interactive

Call a tool, then answer

The model does not have live weather. With a tool, it asks your app. Your app runs the tool and hands the result back. Without a tool, it can only guess.

User

Model

has 1 tool

Your app

runs the tool

Weather API

live data

Ask the model and watch where the request goes.

Step 1 of 5

  1. 1

    Read the question

    Some questions can be answered from the prompt. This one cannot.

    What is the weather in Lahore right now?

  2. 2

    Decide whether a tool is needed

    The model picks a tool only if you gave it one. Otherwise it has to improvise.

    get_weather can answer a city and a time of “now”.

  3. 3

    Write the tool call

    This is data for your app, not the answer the user sees.

    get_weather({ "city": "Lahore" })

  4. 4

    Run the tool in your app

    The model does not fetch the weather. Your server does, then returns JSON.

    { "temp": 34, "unit": "C", "note": "sample reading" }

  5. 5

    Answer from what came back

    With a result, the sentence quotes it. Without one, the number is made up.

    It is 34°C in Lahore right now.

    Grounded in the sample reading.