← Fintech GlossaryAI & LLM

Function Calling

Function calling is a capability of large language models that allows them to detect when a user's request requires invoking a predefined function or API, generate the appropriate function call with parameters, and process the returned result. Unlike tool use which describes the broader system of agent-tool interaction, function calling specifically refers to the LLM's ability to output structured function call requests that can be executed by the system. This capability is a key enabler for building AI agents that can interact with external systems and data sources. Function calling works by providing the LLM with a set of function definitions at inference time, where each function is described by its name, a description of what it does, and a JSON schema defining its parameters. When the LLM determines that a user's request would be best served by calling a function, it generates a structured JSON object containing the function name and parameter values. The system then executes the function, passing the generated parameters, and returns the result back to the LLM, which uses it to formulate a final response. Modern LLMs like Claude and GPT-4o support advanced function calling features including parallel function calls where the model can invoke multiple functions simultaneously, recursive function calling where the model can chain multiple function calls based on previous results, and streaming function calls where the model can begin processing results before the full response is generated. The quality of function calling depends on the clarity of the function definitions, the LLM's ability to understand when to call each function, and its accuracy in generating the correct parameter values. Financial institutions use function calling to build AI agents that can query databases, execute calculations, access APIs, and trigger workflows, all through natural language interactions. The security of function calling is critical, as the LLM must be prevented from calling functions with malicious or invalid parameters. Proper input validation, parameter sanitization, and access control are essential for production deployments.

In Financial Services

In financial services, function calling is the technical foundation that enables AI agents to interact with the complex ecosystem of financial systems and data sources. Financial institutions use function calling to build AI assistants that can access real-time market data, query customer databases, check compliance status, and generate reports β€” all through natural language. For example, a financial analyst might ask 'What is the current P/E ratio of Apple and how does it compare to the technology sector average?' The LLM uses function calling to invoke a market data API function with the ticker symbol 'AAPL', then a sector analytics function with the technology sector identifier, and finally a calculation function to compute the comparison. Each function call is made with the correct parameters extracted from the conversation context. The quality of function calling in financial applications depends heavily on the LLM's understanding of financial terminology and its ability to map natural language requests to the correct function calls. For example, when a user asks 'Show me the VaR for our fixed income portfolio,' the LLM must recognize that 'VaR' refers to Value at Risk, understand that it's a risk metric, and map it to the correct risk calculation function with the appropriate portfolio identifier and parameters. Financial institutions invest significant effort in designing clear function definitions with precise parameter descriptions that help the LLM make accurate function call decisions. The function definitions must be comprehensive enough to cover all common use cases while remaining unambiguous to prevent incorrect function calls. Financial institutions also implement strict validation on function call parameters, as an incorrect parameter could trigger a wrong calculation or access unauthorized data. For example, a function to retrieve customer account information must validate that the requesting user has permission to access the specified account. Function calling is also used for multi-step financial workflows, where the LLM chains multiple function calls to accomplish a complex task. For example, a loan application workflow might involve calling functions for identity verification, credit check, document analysis, and compliance screening, all orchestrated through function calls from the LLM.

Real-World Example

A large asset manager implements function calling in its AI-powered research assistant. The system has 20 function definitions covering market data, financial statements, analyst ratings, economic indicators, and portfolio analytics. An analyst asks 'Find the three most profitable dividend stocks in the S&P 500 with a payout ratio under 50%.' The LLM uses function calling to invoke the stock screener function with parameters for dividend yield, payout ratio, and index membership, then calls the financial data function to retrieve profitability metrics for the filtered stocks, and finally calls the ranking function to sort by profitability. The system returns a table with the three stocks and their key metrics. The asset manager reports that 85% of function calls are made with correct parameters on the first attempt, and the system handles 2,000 financial queries per day, reducing manual research time by 70%. The system logs all function calls for audit purposes, and any function call with anomalous parameters is flagged for review.

Why It Matters for Finance

Function calling is the technical capability that makes AI agents practical for financial services. Without function calling, LLMs can only generate text based on their training data, which may be outdated or incomplete. Function calling enables LLMs to access real-time data, execute precise calculations, and interact with the systems that financial professionals use daily. The quality of function calling determines how effectively an AI agent can serve financial users β€” accurate function calling means the agent gets the right data and performs the right actions, while errors in function calling can lead to incorrect results or security issues. As financial institutions deploy more sophisticated AI agents, function calling becomes the critical interface between natural language understanding and financial system operations.

Related Terms

Tool UseAI AgentMCP Server (Model Context Protocol)API IntegrationLarge Language Model (LLM)

Explore in Finatune

ClaudeGPT-4o

Frequently Asked Questions

What is function calling in AI?

Function calling is a capability of large language models that allows them to detect when a user's request requires invoking a predefined function, generate the appropriate function call with parameters, and process the returned result from the system.

How is function calling used in financial AI applications?

Function calling is used in financial AI to query real-time market data, retrieve customer information, check compliance status, calculate risk metrics, and trigger financial workflows. The LLM maps natural language requests to the correct function calls with appropriate parameters.

Which LLMs support function calling for financial workflows?

Claude by Anthropic and GPT-4o by OpenAI both support advanced function calling features including parallel calls, recursive chaining, and streaming. Both models are widely used for financial AI applications requiring function calling.

← Previous Term: Fine-Tuning (AI)
Next Term: Graphics Processing Unit (GPU) β†’
View All Fintech Terms β†’