GENERATIVE AI • LESSON 6

Why AI Needs Tools

So far, you've learned that an LLM can:

  • Understand questions
  • Generate text
  • Summarize information
  • Write code
  • Explain concepts
CORE IDEA

An LLM can generate an answer, but it cannot automatically access or control everything in the real world.

That's why AI tools are important.

01

The Basic Idea

Imagine you ask an AI:

"What is Python?"

The LLM can answer directly.

User
  ↓
"What is Python?"
  ↓
LLM
  ↓
Answer

No external tool is required.

But now ask:

"What's the current weather in Hyderabad?"

The AI needs current information.

User
  ↓
"What's the weather?"
  ↓
LLM
  ↓
Weather Tool
  ↓
Weather API
  ↓
Current weather
  ↓
LLM
  ↓
Answer

This is the fundamental reason AI needs tools.

The Most Important Difference

This is something you should understand very clearly.

LLM

Thinks / understands / generates.

Tool

Performs an operation or retrieves information.

For example:

LLM
"What should I do?"
        ↓
Tool
"Actually perform the operation"

A simple mental model:

LLM Brain
TOOL Hands

This isn't technically perfect, but it's an excellent beginner mental model.

Simple Python Example

Let's start without any AI API.

Create a normal Python function:

def get_weather(city):
    return f"The weather in {city} is 30°C."


result = get_weather("Hyderabad")

print(result)

Output:

The weather in Hyderabad is 30°C.

Here:

get_weather()

is our tool.

The function itself isn't AI.

It's normal Python code.

That's important.

Where Does AI Come Into This?

Now imagine the user says:

"What's the weather in Hyderabad?"

The LLM understands:

"The user wants weather information."

It can decide:

"I need the weather tool."

Then your Python application executes:

get_weather("Hyderabad")

Conceptually:

User
  ↓
What's the weather in Hyderabad?
  ↓
LLM
  ↓
Needs weather tool
  ↓
get_weather("Hyderabad")
  ↓
Tool result
  ↓
LLM
  ↓
Final answer

This is the beginning of tool calling.

Practical Python Exercise

Before using an actual AI API, let students understand the concept using plain Python.

Create:

def get_weather(city):
    weather_data = {
        "Hyderabad": "30°C and sunny",
        "Delhi": "27°C and cloudy",
        "Mumbai": "29°C and rainy"
    }

    return weather_data.get(
        city,
        "Weather information not available."
    )


city = input("Enter city: ")

result = get_weather(city)

print("Weather:", result)

Run it:

Enter city: Hyderabad

Weather: 30°C and sunny

This is not an AI agent yet.

It's simply a tool.

That's intentional.

Students need to understand the tool first.