Function calling lets an AI model request execution of developer-provided functions, obtain external results, and incorporate those results into its response. It extends a model beyond its training data to access real-time information or perform specialized actions. section 4.4
A function-calling workflow connects the model to application capabilities:
- Recognize when external information or an action is needed. section 4.4
- Request execution of a specific function or tool. section 4.4
- Run the supplied function against an external resource, such as an API. section 4.4
- Return the result so the model can produce a structured, relevant response. section 4.3.2 section 4.4
Weather lookup
For a question about the weather in a particular region, the model can request a weather API call, receive current regional data, and use that result in its response instead of relying only on its trained knowledge. section 4.4
Function calling also supports structured responses: a function schema constrains the model’s requested data structure, while schema validation can improve type safety and data integrity. In the Vercel AI SDK, custom tools are defined, registered, and handled as React components. section 4.3.2 section 4.5






