diff --git a/Package.swift b/Package.swift index ddfb6c7..cc69ae9 100644 --- a/Package.swift +++ b/Package.swift @@ -20,7 +20,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/fumito-ito/FunctionCalling", from: "0.5.0"), - .package(url: "https://github.com/lzell/AIProxySwift.git", from: "0.43.0") + .package(url: "https://github.com/lzell/AIProxySwift.git", from: "0.44.0") ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift b/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift index e6052e1..6c4a37f 100644 --- a/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift +++ b/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift @@ -5,13 +5,17 @@ import FunctionCalling import AIProxy extension ToolContainer { + public typealias AIProxyOpenAITool = OpenAIChatCompletionRequestBody.Tool + public typealias AIProxyAnthropicTool = AnthropicTool + public typealias AIProxyTogetherAITool = TogetherAITool + // swiftlint:disable:next line_length // https://github.com/lzell/AIProxySwift?tab=readme-ov-file#how-to-use-openai-structured-outputs-json-schemas-in-a-tool-call - func toOpenAITools(strict: Bool = false) -> [OpenAIChatCompletionTool] { + func toOpenAITools(strict: Bool = false) -> [AIProxyOpenAITool] { guard let allTools else { return [] } return allTools.map { tool in - OpenAIChatCompletionTool.function( + AIProxyOpenAITool.function( name: tool.name, description: tool.description, parameters: tool.inputSchema.toJSONSchema(), @@ -21,11 +25,11 @@ extension ToolContainer { } // https://github.com/lzell/AIProxySwift?tab=readme-ov-file#how-to-use-streaming-tool-calls-with-anthropic - func toAnthropicTools() -> [AnthropicTool] { + func toAnthropicTools() -> [AIProxyAnthropicTool] { guard let allTools else { return [] } return allTools.map { tool in - AnthropicTool( + AIProxyAnthropicTool( description: tool.description, inputSchema: tool.inputSchema.toJSONSchema(), name: tool.name @@ -35,11 +39,11 @@ extension ToolContainer { // swiftlint:disable:next line_length // https://github.com/lzell/AIProxySwift?tab=readme-ov-file#how-to-make-a-tool-call-request-with-llama-and-togetherai - func toTogetherAITools() -> [TogetherAITool] { + func toTogetherAITools() -> [AIProxyTogetherAITool] { guard let allTools else { return [] } return allTools.map { tool in - TogetherAITool( + AIProxyTogetherAITool( function: .init( description: tool.description, name: tool.name,