In the previous articles, we learned how an LLM generates text and how techniques like RAG and CAG help it answer questions using external knowledge. At this point, our AI-powered Travel Planner can answer questions like "I'm visiting Japan for 7 days. Suggest an itinerary." or "Recommend vegetarian ramen near Tokyo Station." That's useful, but it's still just a chatbot.

What if the user asks to "Book the cheapest flight from Mumbai to Tokyo.", "What's the weather in Kyoto this weekend?", or "Remember that I prefer vegetarian food and always choose a window seat."? An LLM cannot execute these actions by itself. To build real, production-ready AI applications, we need to connect the model to the outside world. Let's see how that works.

Tool Calling (Function Calling): Letting AI Use External Tools

Suppose the user asks: "What's the weather in Kyoto tomorrow?" Since the LLM doesn't know tomorrow's forecast, our application can provide the model with a weather API. The workflow is simple: the LLM understands the request, determines that it needs the weather tool, calls the Weather API (via the client application), receives the live weather data, and generates the final grounded response.