Skip to content

Commit b04007b

Browse files
committed
adopt new interface
1 parent a8ee366 commit b04007b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Sources/FunctionCalling-GoogleGenerativeAI/FunctionCalling_GoogleGenerativeAI.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ typealias FunctionCallingTool = FunctionCalling.Tool
99

1010
extension ToolContainer {
1111
public var googleGenerativeAITools: [GoogleGenerativeAI.Tool] {
12-
get throws {
13-
let data = allTools.data(using: .utf8)!
14-
let functionCallingTools = try JSONDecoder().decode([FunctionCallingTool].self, from: data)
15-
let googleGenerativeAITools = functionCallingTools.map { $0.toFunctionDeclaration }
16-
17-
return [GoogleGenerativeAI.Tool(functionDeclarations: googleGenerativeAITools)]
18-
}
12+
[
13+
GoogleGenerativeAI.Tool(
14+
functionDeclarations: allTools?.compactMap { $0.toFunctionDeclaration }
15+
)
16+
]
1917
}
2018
}

0 commit comments

Comments
 (0)