FirebaseVertexAI Framework Reference Stay organized with collections Save and categorize content based on your preferences.
Tool
@available(iOS15.0,macOS12.0,tvOS15.0,watchOS8.0,*)publicstructTool:SendableextensionTool:EncodableA helper tool that the model may use when generating responses.
ATool is a piece of code that enables the system to interact with external systems to performan action, or set of actions, outside of knowledge and scope of the model.
Creates a tool that allows the model to perform function calling.
Function calling can be used to provide data to the model that was not known at the time itwas trained (for example, the current date or weather conditions) or to allow it to interactwith external systems (for example, making an API request or querying/updating a database).For more details and use cases, seeFunction calling using the GeminiAPI.
Declaration
Swift
publicstaticfuncfunctionDeclarations(_functionDeclarations:[FunctionDeclaration])->ToolParameters
functionDeclarationsA list of
FunctionDeclarationsavailable to the model that can beused for function calling.The model or system does not execute the function. Instead the defined function may bereturned as aFunctionCallPartwith arguments to the client side for execution. Themodel may decide to call none, some or all of the declared functions; this behavior may beconfigured by specifying aToolConfigwhen instantiating the model. When aFunctionCallPartis received, the next conversation turn may contain aFunctionResponsePartinpartswith aroleof"function"; this response contains the result of executing the function on the client,providing generation context for the model’s next turn.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-17 UTC.