Skip to content

Commit abdd7e6

Browse files
authored
improve logging (#26)
* improve logging * swift format
1 parent 22d011b commit abdd7e6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Sources/Converse/BedrockService+ConverseStreaming.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ extension BedrockService {
120120
// see https://github.com/awslabs/aws-sdk-swift/blob/2697fb44f607b9c43ad0ce5ca79867d8d6c545c2/Sources/Services/AWSBedrockRuntime/Sources/AWSBedrockRuntime/Models.swift#L3478
121121
// it will be the responsibility of the user to handle the stream and re-assemble the messages and content
122122

123-
let reply = try ConverseReplyStream(sdkStream)
123+
let reply = try ConverseReplyStream(sdkStream, logger: logger)
124124

125125
// this time, a different stream is created from the previous one, this one has the following elements
126126
// - messageStart: this is the start of a message, it contains the role (assistant or user)

Sources/Converse/Tool.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
import Foundation
1818
import Smithy
1919

20-
public struct Tool: Codable {
20+
public struct Tool: Codable, CustomStringConvertible {
2121
public let name: String
2222
public let inputSchema: JSON
23-
public let description: String?
23+
public let toolDescription: String?
2424

2525
public init(name: String, inputSchema: JSON, description: String? = nil) throws {
2626
guard !name.isEmpty else {
@@ -33,7 +33,7 @@ public struct Tool: Codable {
3333
}
3434
self.name = name
3535
self.inputSchema = inputSchema
36-
self.description = description
36+
self.toolDescription = description
3737
}
3838

3939
public init(from sdkToolSpecification: BedrockRuntimeClientTypes.ToolSpecification) throws {
@@ -67,4 +67,9 @@ public struct Tool: Codable {
6767
name: name
6868
)
6969
}
70+
71+
// for CustomStringConvertible
72+
public var description: String {
73+
"Tool(name: \(name), description: \(toolDescription ?? "nil"))"
74+
}
7075
}

0 commit comments

Comments
 (0)