Function Calling

AI concepts
About 1 min read

A feature that connects an LLM to interpret a user's request and select and call pre-registered external functions or APIs.

Also known as
Function CallingTool UseTool Use

Detailed explanation

Function Calling is a feature that allows an LLM to interpret a user's request, select the appropriate function or API from a pre-registered list, and construct the call with the necessary arguments. Instead of executing the code itself, the model outputs the function name and arguments in a structured format (JSON), leaving the actual execution and return of results to the application. This enables the model to perform tasks it cannot do on its own, such as real-time data retrieval, calculations, database queries, and integration with external services. Supported by major providers like OpenAI, Anthropic, and Google, it serves as a core mechanism for building AI agents.

Why it matters in tool selection

Support for Function Calling is the dividing line between simple chatbots and AI agents that handle actual tasks. To automate tasks by integrating with external systems, the model must be able to structure function calls reliably. When choosing a tool, it is recommended to check whether it can call multiple functions simultaneously, enforce call argument formats with schemas, and implement retry/validation logic in case of call failures.

What to check when choosing a tool

  • Can it enforce function arguments with a JSON schema to reduce formatting errors?
  • Can it call multiple functions in parallel within a single response?
  • Can it pass the execution results back to the model to continue subsequent reasoning?
  • Are there verification and retry mechanisms for incorrect calls or missing arguments?

Real-world Application Examples

When receiving a request like "Find flights for my business trip to Busan next week," the model, instead of hallucinating an answer, designates the search_flights function to be called and returns it populated with departure, destination, and date arguments. Once the application calls the actual flight API and passes the results back, the model formats the information into a human-readable response.

Related terms

AI AgentLLMAPI