ToolRepresentable
public protocol ToolRepresentable : SendableUndocumented
-
Undocumented
Declaration
Swift
var toolRepresentation: FirebaseAILogic.Tool { get }
-
Extension methodfunctionDeclarations(_:)
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 it was trained (for example, the current date or weather conditions) or to allow it to interact with external systems (for example, making an API request or querying/updating a database). For more details and use cases, see Function calling using the Gemini API.
Declaration
Swift
static func functionDeclarations(_ functionDeclarations: [FunctionDeclaration]) -> ToolParameters
functionDeclarationsA list of
FunctionDeclarationsavailable to the model that can be used for function calling. The model or system does not execute the function. Instead the defined function may be returned as aFunctionCallPartwith arguments to the client side for execution. The model may decide to call none, some or all of the declared functions; this behavior may be configured 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. -
Extension methodautoFunctionDeclaration(_:)
-
Extension methodgoogleSearch(_:)
Creates a tool that allows the model to use Grounding with Google Search.
Grounding with Google Search can be used to allow the model to connect to Google Search to access and incorporate up-to-date information from the web into it's responses.
Important
When using this feature, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: Gemini Developer API or Vertex AI Gemini API (see Service Terms section within the Service Specific Terms).
Declaration
Swift
static func googleSearch(_ googleSearch: GoogleSearch = GoogleSearch()) -> ToolParameters
googleSearchAn empty
GoogleSearchobject. The presence of this object in the list of tools enables the model to use Google Search.Return Value
A
Toolconfigured for Google Search. -
Extension methodgoogleMaps()
Creates a tool that allows the model to use Grounding with Google Maps.
Grounding with Google Maps can be used to allow the model to connect to Google Maps to access and incorporate up-to-date information from the web into it's responses.
Important
When using this feature, you are required to comply with the "Grounding with Google Maps" usage requirements for your chosen API provider.
Declaration
Swift
static func googleMaps() -> ToolReturn Value
A
Toolconfigured for Google Maps. -
Extension methodurlContext()
Creates a tool that allows you to provide additional context to the models in the form of public web URLs.
By including URLs in your request, the Gemini model will access the content from those pages to inform and enhance its response.
Declaration
Swift
static func urlContext() -> Tool -
Extension methodcodeExecution()
Creates a tool that allows the model to execute code.
For more details, see
CodeExecution.Declaration
Swift
static func codeExecution() -> Tool