Function Calling
Function calling is a feature that allows an AI model, like a large language model (LLM), to identify when a user's request requires an external tool or action and then generate the structured request needed to perform it.
How it works
Instead of just generating text, the model analyzes a prompt and, if needed, outputs a formatted call (like a JSON object) for a predefined function, such as getting the weather or sending an email. This bridges the gap between conversational AI and practical software actions, enabling AI assistants to interact with the real world. It's a core technique for building capable AI agents.
Examples
- 1.A user asks a chatbot 'What's the weather in Tokyo?' and the AI calls a weather API function to fetch and report the current data.
- 2.A user says 'Schedule a meeting with Alex at 3 PM tomorrow,' prompting the AI to call a calendar API function to create the event.
- 3.In a customer service bot, a user's request to 'reset my password' triggers the AI to call the account management system's specific password reset function.