From 9b5a75b31b21c434fc71b232bd57fd278b303ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Fri, 19 Sep 2025 18:03:26 +0200 Subject: [PATCH 1/2] make Tool Sendable --- Sources/Converse/Tool.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Converse/Tool.swift b/Sources/Converse/Tool.swift index 4aafc21..be977fc 100644 --- a/Sources/Converse/Tool.swift +++ b/Sources/Converse/Tool.swift @@ -22,7 +22,7 @@ import FoundationEssentials import Foundation #endif -public struct Tool: Codable, CustomStringConvertible { +public struct Tool: Codable, CustomStringConvertible, Sendable { public let name: String public let inputSchema: JSON public let toolDescription: String? From d92625332888fcc001ad754d7a3b0d45d50114aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Stormacq?= Date: Tue, 23 Sep 2025 13:21:58 +0200 Subject: [PATCH 2/2] Restric TollResultBlock to be created from Encodable data --- Sources/Converse/ContentBlocks/ToolResultBlock.swift | 2 +- Sources/Converse/ConverseRequestBuilder.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Converse/ContentBlocks/ToolResultBlock.swift b/Sources/Converse/ContentBlocks/ToolResultBlock.swift index 20252ce..396b1fe 100644 --- a/Sources/Converse/ContentBlocks/ToolResultBlock.swift +++ b/Sources/Converse/ContentBlocks/ToolResultBlock.swift @@ -71,7 +71,7 @@ public struct ToolResultBlock: Codable, Sendable { } /// convenience initializer for ToolResultBlock for any Codable - public init(_ object: T, id: String, status: Status? = .success) throws { + public init(_ object: T, id: String, status: Status? = .success) throws { guard let data = try? JSONEncoder().encode(object) else { throw BedrockLibraryError.encodingError("Could not encode object to JSON") } diff --git a/Sources/Converse/ConverseRequestBuilder.swift b/Sources/Converse/ConverseRequestBuilder.swift index f63de00..deac253 100644 --- a/Sources/Converse/ConverseRequestBuilder.swift +++ b/Sources/Converse/ConverseRequestBuilder.swift @@ -286,7 +286,7 @@ public struct ConverseRequestBuilder { return try self.withToolResult(toolResult) } - public func withToolResult( + public func withToolResult( _ object: C, id: String? = nil, status: ToolResultBlock.Status? = nil