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
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -59,15 +59,15 @@ extension FunctionCalling.InputSchema {
}

extension Optional<String> {
var toStringFormat: FirebaseVertexAI.Schema.StringFormat? {
var toStringFormat: Schema.StringFormat? {
guard let format = self else {
return nil
}

return .custom(format)
}

var toIntegerFormat: FirebaseVertexAI.Schema.IntegerFormat? {
var toIntegerFormat: Schema.IntegerFormat? {
guard let format = self else {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [:]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
}
}