diff --git a/Package.swift b/Package.swift index 2392491..a32efa1 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/fumito-ito/FunctionCalling", from: "0.5.0"), - .package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "11.15.0") + .package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "12.1.0") ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -26,7 +26,7 @@ let package = Package( name: "FunctionCalling-FirebaseVertexAI", dependencies: [ .product(name: "FunctionCalling", package: "FunctionCalling"), - .product(name: "FirebaseVertexAI", package: "firebase-ios-sdk") + .product(name: "FirebaseAI", package: "firebase-ios-sdk") ] ), .testTarget( diff --git a/Sources/FunctionCalling-FirebaseVertexAI/Extension/FirebaseAI+Extension.swift b/Sources/FunctionCalling-FirebaseVertexAI/Extension/FirebaseAI+Extension.swift new file mode 100644 index 0000000..8ae7ed4 --- /dev/null +++ b/Sources/FunctionCalling-FirebaseVertexAI/Extension/FirebaseAI+Extension.swift @@ -0,0 +1,13 @@ +// +// FirebaseAI+Extension.swift +// FunctionCalling-FirebaseVertexAI +// +// Created by 伊藤史 on 2025/08/06. +// + +import FirebaseAI + +// FIXME: "Since specifying FirebaseAI.Tool results in the error 'Tool' is not a +// member type of class 'FirebaseAI.FirebaseAI', I have no choice but to +// specify a typealias +public typealias FirebaseAITool = Tool diff --git a/Sources/FunctionCalling-FirebaseVertexAI/Extension/InputSchema+Extension.swift b/Sources/FunctionCalling-FirebaseVertexAI/Extension/InputSchema+Extension.swift index 28c6b6c..4ece6a0 100644 --- a/Sources/FunctionCalling-FirebaseVertexAI/Extension/InputSchema+Extension.swift +++ b/Sources/FunctionCalling-FirebaseVertexAI/Extension/InputSchema+Extension.swift @@ -6,10 +6,10 @@ // import FunctionCalling -import FirebaseVertexAI +import FirebaseAI extension FunctionCalling.InputSchema { - var toSchema: FirebaseVertexAI.Schema { + var toSchema: Schema { switch type { case .string: return .string( @@ -59,7 +59,7 @@ extension FunctionCalling.InputSchema { } extension Optional { - var toStringFormat: FirebaseVertexAI.Schema.StringFormat? { + var toStringFormat: Schema.StringFormat? { guard let format = self else { return nil } @@ -67,7 +67,7 @@ extension Optional { return .custom(format) } - var toIntegerFormat: FirebaseVertexAI.Schema.IntegerFormat? { + var toIntegerFormat: Schema.IntegerFormat? { guard let format = self else { return nil } diff --git a/Sources/FunctionCalling-FirebaseVertexAI/Extension/Tool+Extension.swift b/Sources/FunctionCalling-FirebaseVertexAI/Extension/Tool+Extension.swift index 8a50960..755094a 100644 --- a/Sources/FunctionCalling-FirebaseVertexAI/Extension/Tool+Extension.swift +++ b/Sources/FunctionCalling-FirebaseVertexAI/Extension/Tool+Extension.swift @@ -6,11 +6,11 @@ // import FunctionCalling -import FirebaseVertexAI +import FirebaseAI extension FunctionCalling.Tool { - var toFunctionDeclaration: FirebaseVertexAI.FunctionDeclaration { - let parameters: [String: FirebaseVertexAI.Schema] = { + var toFunctionDeclaration: FunctionDeclaration { + let parameters: [String: Schema] = { guard let properties = inputSchema.properties else { return [:] } diff --git a/Sources/FunctionCalling-FirebaseVertexAI/FunctionCalling_FirebaseVertexAI.swift b/Sources/FunctionCalling-FirebaseVertexAI/FunctionCalling_FirebaseVertexAI.swift index cf3f4af..856cf7a 100644 --- a/Sources/FunctionCalling-FirebaseVertexAI/FunctionCalling_FirebaseVertexAI.swift +++ b/Sources/FunctionCalling-FirebaseVertexAI/FunctionCalling_FirebaseVertexAI.swift @@ -6,15 +6,14 @@ // import FunctionCalling -import FirebaseVertexAI -import Foundation +import FirebaseAI extension ToolContainer { - public var firebaseVertexAITools: [FirebaseVertexAI.Tool] { + public var firebaseVertexAITools: [FirebaseAITool] { guard let declarations = allTools?.compactMap({ $0.toFunctionDeclaration }) else { return [.functionDeclarations([])] } - return [FirebaseVertexAI.Tool.functionDeclarations(declarations)] + return [FirebaseAITool.functionDeclarations(declarations)] } }