Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import PackageDescription

let package = Package(
name: "FunctionCalling-FirebaseVertexAI",
name: "FunctionCalling-FirebaseAI",
platforms: [
.macOS(.v13),
.iOS(.v17)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "FunctionCalling-FirebaseVertexAI",
targets: ["FunctionCalling-FirebaseVertexAI"])
name: "FunctionCalling-FirebaseAI",
targets: ["FunctionCalling-FirebaseAI"])
],
dependencies: [
.package(url: "https://github.com/fumito-ito/FunctionCalling", from: "0.5.0"),
Expand All @@ -23,14 +23,14 @@ let package = Package(
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "FunctionCalling-FirebaseVertexAI",
name: "FunctionCalling-FirebaseAI",
dependencies: [
.product(name: "FunctionCalling", package: "FunctionCalling"),
.product(name: "FirebaseAI", package: "firebase-ios-sdk")
]
),
.testTarget(
name: "FunctionCalling-FirebaseVertexAITests",
dependencies: ["FunctionCalling-FirebaseVertexAI"])
name: "FunctionCalling-FirebaseAITests",
dependencies: ["FunctionCalling-FirebaseAI"])
]
)
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# FunctionCalling-FirebaseVertexAI
# FunctionCalling-FirebaseAI

This library simplifies the integration of the [FunctionCalling](https://github.com/fumito-ito/FunctionCalling) macro into [FirebaseVertexAI](https://github.com/firebase/firebase-ios-sdk/tree/main/FirebaseVertexAI). By using this library, you can directly generate `Tool` objects from Swift native functions, which can then be specified as FunctionCalling when invoking VertexAI.
This library simplifies the integration of the [FunctionCalling](https://github.com/fumito-ito/FunctionCalling) macro into [FirebaseAI](https://github.com/firebase/firebase-ios-sdk/tree/main/FirebaseAI). By using this library, you can directly generate `Tool` objects from Swift native functions, which can then be specified as FunctionCalling when invoking FirebaseAI.

## Usage

```swift

import FunctionCalling
import FunctionCalling_FirebaseVertexAI
import FirebaseVertexAI
import FunctionCalling_FirebaseAI
import FirebaseAI

// MARK: Declare the container and functions for the tools to be called from FunctionCalling.

Expand All @@ -23,9 +23,9 @@ struct MyFunctionTools {
}
}

// MARK: You can directly pass the tools generated from objects to the model in VertexAI.
// MARK: You can directly pass the tools generated from objects to the model in FirebaseAI.

let model = VertexAI.vertexAI().generativeModel(
let model = FirebaseAI.firebaseAI().generativeModel(
modelName: "gemini-1.5-flash",
tools: MyFunctionTools().firebaseVertexAITools
)
Expand All @@ -43,12 +43,12 @@ let package = Package(
.target(
"YouAppModule",
dependencies: [
.product(name: "FunctionCalling-FirebaseVertexAI", package: "FunctionCalling-FirebaseVertexAI")
.product(name: "FunctionCalling-FirebaseAI", package: "FunctionCalling-FirebaseAI")
]
)
],
dependencies: [
.package(url: "https://github.com/FunctionCalling/FunctionCalling-FirebaseVertexAI", from: "0.1.0")
.package(url: "https://github.com/FunctionCalling/FunctionCalling-FirebaseAI", from: "0.1.0")
]
)
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// FirebaseAI+Extension.swift
// FunctionCalling-FirebaseVertexAI
// FunctionCalling-FirebaseAI
//
// Created by 伊藤史 on 2025/08/06.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// FunctionCalling_FirebaseVertexAI.swift
// FunctionCalling_FirebaseAI.swift
//
//
// Created by Fumito Ito on 2024/09/07.
Expand All @@ -9,7 +9,7 @@ import FunctionCalling
import FirebaseAI

extension ToolContainer {
public var firebaseVertexAITools: [FirebaseAITool] {
public var firebaseAITools: [FirebaseAITool] {
guard let declarations = allTools?.compactMap({ $0.toFunctionDeclaration }) else {
return [.functionDeclarations([])]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import XCTest
@testable import FunctionCalling_FirebaseVertexAI
@testable import FunctionCalling_FirebaseAI
import FunctionCalling

// swiftlint:disable:next type_name
final class FunctionCalling_FirebaseVertexAITests: XCTestCase {
final class FunctionCalling_FirebaseAITests: XCTestCase {
@FunctionCalling(service: .claude)
struct FunctionContainer {
/// Return current weather of location that passed by the argument
Expand All @@ -21,7 +21,7 @@ final class FunctionCalling_FirebaseVertexAITests: XCTestCase {
}

func testConvertedResults() throws {
guard let tool = FunctionContainer().firebaseVertexAITools.first else {
guard let tool = FunctionContainer().firebaseAITools.first else {
XCTFail("Conainer should contain some functions")
return
}
Expand Down