diff --git a/Sources/GoogleAI/FunctionCalling.swift b/Sources/GoogleAI/FunctionCalling.swift index 159c8b4..3775895 100644 --- a/Sources/GoogleAI/FunctionCalling.swift +++ b/Sources/GoogleAI/FunctionCalling.swift @@ -164,6 +164,9 @@ public struct Tool { /// Enables the model to execute code as part of generation. let codeExecution: CodeExecution? + /// Enables the Google Search + let googleSearch: GoogleSearch? + /// Constructs a new `Tool`. /// /// - Parameters: @@ -176,10 +179,13 @@ public struct Tool { /// ``FunctionResponse`` in ``ModelContent/Part/functionResponse(_:)`` with the /// ``ModelContent/role`` "function", providing generation context for the next model turn. /// - codeExecution: Enables the model to execute code as part of generation, if provided. + /// - googleSearch: Enables the Google Search. public init(functionDeclarations: [FunctionDeclaration]? = nil, - codeExecution: CodeExecution? = nil) { + codeExecution: CodeExecution? = nil, + googleSearch: GoogleSearch? = nil) { self.functionDeclarations = functionDeclarations self.codeExecution = codeExecution + self.googleSearch = googleSearch } } @@ -259,6 +265,12 @@ public struct CodeExecution { public init() {} } +/// Tool for grounding with Google Search +public struct GoogleSearch { + /// Constructs a new `GoogleSearch` tool. + public init() {} +} + /// Code generated by the model that is meant to be executed, and the result returned to the model. /// /// Only generated when using the ``CodeExecution`` tool, in which case the code will automatically @@ -351,6 +363,8 @@ extension FunctionResponse: Encodable {} extension CodeExecution: Encodable {} +extension GoogleSearch: Encodable {} + extension ExecutableCode: Codable {} @available(iOS 15.0, macOS 11.0, macCatalyst 15.0, *)