From 69366c32fc88203da3b7f022377f26d1edf9b016 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 19:07:21 +0000 Subject: [PATCH 1/3] Update dependency firebase/firebase-ios-sdk to from: "11.13.0" --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 760fe3a..b110d64 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.11.0") + .package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "11.13.0") ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. From 1c0f537acaf95ef43b8aca97785e29472bd04d46 Mon Sep 17 00:00:00 2001 From: Fumito Ito Date: Tue, 27 May 2025 02:27:22 +0900 Subject: [PATCH 2/3] use Xcode 16.0 or higher for firebase-ios-sdk 11.12.0+ --- .github/workflows/swift.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 92a797f..ac670ec 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -13,6 +13,8 @@ jobs: runs-on: macos-14 steps: - uses: actions/checkout@v4 + - name: Change Xcode version + run: sudo xcode-select -s /Applications/Xcode_16.2.app - name: Install swiftlint run: | brew update From 2ac5d28ff1cbd8beee01f72126a0d54855bdec2a Mon Sep 17 00:00:00 2001 From: Fumito Ito Date: Tue, 27 May 2025 02:50:26 +0900 Subject: [PATCH 3/3] fix tests --- .../Extensions.swift | 24 ------------------ ...unctionCalling_FirebaseVertexAITests.swift | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 31 deletions(-) delete mode 100644 Tests/FunctionCalling-FirebaseVertexAITests/Extensions.swift diff --git a/Tests/FunctionCalling-FirebaseVertexAITests/Extensions.swift b/Tests/FunctionCalling-FirebaseVertexAITests/Extensions.swift deleted file mode 100644 index 8efe9a5..0000000 --- a/Tests/FunctionCalling-FirebaseVertexAITests/Extensions.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// Extensions.swift -// FunctionCalling-FirebaseVertexAI -// -// Created by 伊藤史 on 2024/09/20. -// - -@testable import FirebaseVertexAI - -extension FirebaseVertexAI.Tool { - var functions: [FirebaseVertexAI.FunctionDeclaration]? { - functionDeclarations - } -} - -extension FirebaseVertexAI.FunctionDeclaration { - func getName() -> String { - name - } - - func getDescription() -> String { - description - } -} diff --git a/Tests/FunctionCalling-FirebaseVertexAITests/FunctionCalling_FirebaseVertexAITests.swift b/Tests/FunctionCalling-FirebaseVertexAITests/FunctionCalling_FirebaseVertexAITests.swift index 05fd7e4..0d60b14 100644 --- a/Tests/FunctionCalling-FirebaseVertexAITests/FunctionCalling_FirebaseVertexAITests.swift +++ b/Tests/FunctionCalling-FirebaseVertexAITests/FunctionCalling_FirebaseVertexAITests.swift @@ -21,20 +21,31 @@ final class FunctionCalling_FirebaseVertexAITests: XCTestCase { } func testConvertedResults() throws { - guard let functions = FunctionContainer().firebaseVertexAITools.first?.functions else { + guard let tool = FunctionContainer().firebaseVertexAITools.first else { XCTFail("Conainer should contain some functions") return } + let encodedToolData = try JSONEncoder().encode(tool) + let jsonObject = try JSONSerialization.jsonObject(with: encodedToolData) + + guard let toolDictionary = jsonObject as? [String: Any] else { + XCTFail("Failed to convert to JSON object") + return + } + + guard let functions = toolDictionary["functionDeclarations"] as? [[String: Any]] else { + XCTFail("Failed to convert to JSON object") + return + } + XCTAssertEqual(functions.count, 2) - let getWeather = try XCTUnwrap(functions.first) - XCTAssertEqual(getWeather.getName(), "getWeather") + let getWeather = try XCTUnwrap(functions.first(where: { $0["name"] as? String == "getWeather" })) // swiftlint:disable:next line_length - XCTAssertEqual(getWeather.getDescription(), "Return current weather of location that passed by the argument- Parameter location: location that I want to know how the weather- Returns: string of weather") + XCTAssertEqual(getWeather["description"] as? String, "Return current weather of location that passed by the argument- Parameter location: location that I want to know how the weather- Returns: string of weather") - let getStock = try XCTUnwrap(functions.last) - XCTAssertEqual(getStock.getName(), "getStock") - XCTAssertEqual(getStock.getDescription(), "") + let getStock = try XCTUnwrap(functions.first(where: { $0["name"] as? String == "getStock" })) + XCTAssertEqual(getStock["description"] as? String, "") } }