Skip to content

Commit

Permalink
Merge pull request #58 from ptrkstr/main
Browse files Browse the repository at this point in the history
Fix computer use issues
  • Loading branch information
fumito-ito authored Nov 3, 2024
2 parents 332d41f + 864e863 commit 4d0ba35
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/AnthropicSwiftSDK/Entity/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension Model {
case .claude_3_Haiku:
return "claude-3-haiku-20240307"
case .claude_3_5_Sonnet:
return "claude-3-5-sonnet-20240620"
return "claude-3-5-sonnet-20241022"
case let .custom(modelName):
return modelName
}
Expand Down
15 changes: 14 additions & 1 deletion Sources/AnthropicSwiftSDK/Entity/Tool/Tool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,17 @@ public enum Tool {
case function(FunctionTool)
}

extension Tool: Encodable {}
extension Tool: Encodable {
public func encode(to encoder: any Encoder) throws {
switch self {
case .computer(let tool):
try tool.encode(to: encoder)
case .textEditor(let tool):
try tool.encode(to: encoder)
case .bash(let tool):
try tool.encode(to: encoder)
case .function(let tool):
try tool.encode(to: encoder)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import XCTest
final class BatchResultResponseTests: XCTestCase {
func testDecodeBatchResultResponseSucceeded() throws {
let json = """
{"custom_id":"request_123","result":{"type":"succeeded","message":{"id":"msg_123456","type":"message","role":"assistant","model":"claude-3-5-sonnet-20240620","content":[{"type":"text","text":"Hello again! It's nice to see you. How can I assist you today? Is there anything specific you'd like to chat about or any questions you have?"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":11,"output_tokens":36}}}}
{"custom_id":"request_123","result":{"type":"succeeded","message":{"id":"msg_123456","type":"message","role":"assistant","model":"claude-3-5-sonnet-20241022","content":[{"type":"text","text":"Hello again! It's nice to see you. How can I assist you today? Is there anything specific you'd like to chat about or any questions you have?"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":11,"output_tokens":36}}}}
"""

let jsonData = json.data(using: .utf8)!
Expand Down

0 comments on commit 4d0ba35

Please sign in to comment.