Zubnet AIसीखेंWiki › Function Calling
Using AI

Function Calling

Tool Calling, Tool Use API
AI models के लिए conversation के दौरान external functions का execution request करने का एक structured way। आप names, descriptions, और parameter schemas वाले functions define करते हैं। जब model determine करता है कि एक function एक query का जवाब देने में help करेगा, वो text के बजाय एक structured function call (arguments के साथ) output करता है। आपका code function execute करता है और model को incorporate करने के लिए result return करता है।

यह क्यों matter करता है

Function calling ही वो चीज़ है जो एक chatbot को agent में turn करती है। इसके बिना, एक model सिर्फ text generate कर सकता है। इसके साथ, एक model databases search कर सकता है, APIs call कर सकता है, calculations run कर सकता है, appointments book कर सकता है, emails send कर सकता है — कुछ भी जो आप function के रूप में expose कर सकते हैं। ये हर उस AI assistant के पीछे का mechanism है जो actually कुछ करता है, सिर्फ बात नहीं करता।

Deep Dive

The API flow: (1) you send your prompt plus function definitions (JSON schemas describing each function's name, description, and parameters), (2) the model decides whether to call a function and which one, (3) it outputs a structured function call with specific arguments, (4) your code executes the function and returns the result, (5) the model incorporates the result into its response. Some models can call multiple functions in sequence or in parallel.

Function Calling vs. MCP

Function calling is the model-level primitive: the model outputs structured tool calls. MCP (Model Context Protocol) is a higher-level protocol that standardizes how tools are discovered, described, and connected. Think of function calling as the instruction set and MCP as the operating system — MCP uses function calling underneath but adds tool discovery, authentication, and standardization across providers.

Reliability

Function calling is more reliable than asking a model to output function calls as text (which requires parsing and is error-prone). Providers implement function calling by constraining the model's output to valid function calls matching your schema — similar to structured output. But the model can still choose wrong functions, hallucinate parameter values, or call functions when it shouldn't. Robust applications include validation, error handling, and human-in-the-loop confirmation for high-stakes operations.

संबंधित अवधारणाएँ

← सभी Terms
← Foundation Model GAN →