For Large Language Models (LLMs) to learn function calling, the training data typically includes examples that demonstrate the pattern of calling a function. This can be represented in various formats, but a common approach is to use a structured format that resembles a dialogue or a sequence of instructions where a "user" or "assistant" invokes a function with specific arguments. The representation might vary depending on the specific LLM and its intended application, but here's a general idea of how it might look:
-
Text-based representation: In this format, function calls are represented as text that the model learns to predict or generate. For instance, if the task involves calling a function
get_weather(city)
, the training data might include examples like:User: What is the weather like in Paris? Assistant: I need to call get_weather(city="Paris"). The weather in Paris is sunny.