Skip to content

Commit

Permalink
publish some needed interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
fumito-ito committed Oct 31, 2024
1 parent 75370af commit 68a7d67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/AnthropicSwiftSDK/Entity/Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

/// Type of content block.
enum ContentType: String {
public enum ContentType: String {
/// single string
case text
/// image content
Expand All @@ -33,7 +33,7 @@ public enum Content {
case toolResult(ToolResultContent)

/// The type of content block.
var contentType: ContentType {
public var contentType: ContentType {
switch self {
case .text:
return ContentType.text
Expand Down
6 changes: 6 additions & 0 deletions Sources/AnthropicSwiftSDK/Entity/ToolResultContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public struct ToolResultContent {
public let content: [Content]
/// Set to `true` if the tool execution resulted in an error.
public let isError: Bool?

public init(toolUseId: String, content: [Content], isError: Bool?) {
self.toolUseId = toolUseId
self.content = content
self.isError = isError
}
}

extension ToolResultContent: Encodable {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

extension StreamingResponse {
/// True if `stop_reason` of this StreamingResponse is `tool_use`
var isToolUse: Bool {
public var isToolUse: Bool {
switch self {
case let deltaResponse as StreamingMessageDeltaResponse:
return deltaResponse.isToolUse
Expand Down

0 comments on commit 68a7d67

Please sign in to comment.