Skip to content

Update dependency fumito-ito/FunctionCalling to from: "0.4.0" #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.0.2"),
.package(url: "https://github.com/fumito-ito/FunctionCalling", from: "0.3.0")
.package(url: "https://github.com/fumito-ito/FunctionCalling", from: "0.4.0")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
9 changes: 2 additions & 7 deletions Sources/AnthropicSwiftSDK/Network/MessagesRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public struct MessagesRequest: Encodable {
temperature: Double? = nil,
topP: Double? = nil,
topK: Int? = nil,
tools: String? = nil,
tools: [Tool]? = nil,
toolChoice: ToolChoice = .auto
) {
self.model = model
Expand All @@ -77,12 +77,7 @@ public struct MessagesRequest: Encodable {
self.temperature = temperature
self.topP = topP
self.topK = topK
let tool = tools?.replacingOccurrences(of: "\n", with: "")
if let data = tool?.data(using: .utf8) {
self.tools = try? anthropicJSONDecoder.decode([Tool].self, from: data)
} else {
self.tools = nil
}
self.tools = tools
self.toolChoice = toolChoice
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,20 @@ final class StreamingMessageDeltaResponseTests: XCTestCase {

func testToolContainerIsExecutedByResponse() async throws {
struct MockToolContiner: ToolContainer {
var allToolsJSONString: String {
""
}

var service: FunctionCallingService {
.claude
}

func execute(methodName name: String, parameters: [String : Any]) async -> String {
return "executed,\(name),\(parameters.keys.first ?? "")"
}

var allTools: String {
""
var allTools: [Tool]? {
nil
}
}

Expand Down