We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 124ae00 commit efd280eCopy full SHA for efd280e
1 file changed
Sources/FunctionCalling-FirebaseVertexAI/FunctionCalling_FirebaseVertexAI.swift
@@ -9,16 +9,14 @@ import FunctionCalling
9
import FirebaseVertexAI
10
import Foundation
11
12
-typealias FunctionCallingTool = FunctionCalling.Tool
13
-
14
extension ToolContainer {
15
public var firebaseVertexAITools: [FirebaseVertexAI.Tool] {
16
- get throws {
17
- let data = allTools.data(using: .utf8)!
18
- let functionCallingTools = try JSONDecoder().decode([FunctionCallingTool].self, from: data)
19
- let firebaseVertexAITools = functionCallingTools.map { $0.toFunctionDeclaration }
20
21
- return [FirebaseVertexAI.Tool(functionDeclarations: firebaseVertexAITools)]
+ get {
+ [
+ FirebaseVertexAI.Tool(
+ functionDeclarations: allTools?.compactMap { $0.toFunctionDeclaration }
+ )
+ ]
22
}
23
24
0 commit comments