What is Function calling

AI Terms
Function calling

Published:

Share:

Function calling is a powerful feature that allows us to get structured data from a model in a more reliable way. It’s like having a conversation with the model where we can ask it to perform specific tasks. These tasks are defined as functions, which are essentially sets of instructions that the model can follow. This interaction can help us in various ways such as answering questions, converting natural language into specific actions, or extracting structured data from a text.

In a typical function calling scenario, we first present a query to the model along with a set of functions. The model then decides if it needs to call one or more of these functions based on the query. If it does, it responds with a structured data format, known as a JSON object, that adheres to the schema we’ve defined. This object contains the arguments needed to call the function in our code.

Once we have this JSON object, we can parse it and call our function with the provided arguments. After the function has been executed and we have the results, we can then ask the model to summarize these results back to us. This way, function calling allows us to leverage the model’s capabilities to perform complex tasks and get structured responses.

Latest Posts