From 8988ba5482839a500ec1468402da00ecb3b4e428 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:02:43 +0000 Subject: [PATCH 1/3] Update dependency lzell/AIProxySwift to from: "0.44.0" --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 66cf0fad758ed27210ae0cd14b7fda5221ba0d13 Mon Sep 17 00:00:00 2001 From: Fumito Ito Date: Fri, 6 Dec 2024 10:52:12 +0900 Subject: [PATCH 2/3] accept OpenAI tool type name change --- .../FunctionCalling_AIProxySwift.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift b/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift index e6052e1..59395f7 100644 --- a/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift +++ b/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift @@ -5,13 +5,14 @@ import FunctionCalling import AIProxy extension ToolContainer { + public typealias AIProxyOpenAITool = OpenAIChatCompletionRequestBody.Tool // 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(), From f369656baa944a0bd3f261a76381243dedf72dec Mon Sep 17 00:00:00 2001 From: Fumito Ito Date: Fri, 6 Dec 2024 10:52:43 +0900 Subject: [PATCH 3/3] also use typealias for other types --- .../FunctionCalling_AIProxySwift.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift b/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift index 59395f7..6c4a37f 100644 --- a/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift +++ b/Sources/FunctionCalling-AIProxySwift/FunctionCalling_AIProxySwift.swift @@ -6,6 +6,9 @@ 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) -> [AIProxyOpenAITool] { @@ -22,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 @@ -36,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,