We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8ee366 commit b04007bCopy full SHA for b04007b
Sources/FunctionCalling-GoogleGenerativeAI/FunctionCalling_GoogleGenerativeAI.swift
@@ -9,12 +9,10 @@ typealias FunctionCallingTool = FunctionCalling.Tool
9
10
extension ToolContainer {
11
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
- }
+ [
+ GoogleGenerativeAI.Tool(
+ functionDeclarations: allTools?.compactMap { $0.toFunctionDeclaration }
+ )
+ ]
19
}
20
0 commit comments