ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)

Set your Publisher ID in src/config/ads.ts to display live ads.

ChatGPT & LLM AI Engineering Guide• 6 min read

Function Calling & External Tool Execution

Enable LLMs to query live SQL databases, fetch weather APIs, and execute arithmetic tools autonomously.

How Tool Calling Works

The LLM does NOT execute functions itself. Instead:

1You supply a list of available tool signatures (e.g. get_weather(city: string)).
2The LLM determines if a tool is needed and outputs structured arguments: {"name": "get_weather", "arguments": {"city": "Tokyo"}}.
3Your backend executes the function and sends the result back to the LLM to format the response.
ADVERTISEMENT
Google AdSense Slot (inContentBanner)

Set your Publisher ID in src/config/ads.ts to display live ads.

Test Yourself With Exercise

+15 XP

Does the LLM API directly execute code on your servers during function calling?