Skip to content

Commit e49d722

Browse files
committed
swift-format
1 parent df1fc2b commit e49d722

File tree

5 files changed

+27
-28
lines changed

5 files changed

+27
-28
lines changed

Sources/Converse/Message.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,23 @@ public struct Message: Codable, CustomStringConvertible, Sendable {
151151
)
152152
}
153153

154-
public static func stopReason(fromSDK sdkStopReason: BedrockRuntimeClientTypes.StopReason?) -> StopReason? {
155-
switch sdkStopReason {
156-
case .endTurn:
157-
return .endTurn
158-
case .toolUse:
159-
return .toolUse
160-
case .maxTokens:
161-
return .maxTokens
162-
case .stopSequence:
163-
return .stopSequence
164-
case .guardrailIntervened:
165-
return .guardrailIntervened
166-
case .contentFiltered:
167-
return .contentFiltered
168-
default:
169-
return nil
170-
}
171-
}
154+
public static func stopReason(fromSDK sdkStopReason: BedrockRuntimeClientTypes.StopReason?) -> StopReason? {
155+
switch sdkStopReason {
156+
case .endTurn:
157+
return .endTurn
158+
case .toolUse:
159+
return .toolUse
160+
case .maxTokens:
161+
return .maxTokens
162+
case .stopSequence:
163+
return .stopSequence
164+
case .guardrailIntervened:
165+
return .guardrailIntervened
166+
case .contentFiltered:
167+
return .contentFiltered
168+
default:
169+
return nil
170+
}
171+
}
172172

173173
}

Sources/Converse/Streaming/ConverseReplyStream.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public struct ConverseReplyStream: Sendable {
147147

148148
// reassemble buffered data and emit top-level event
149149
try ConverseReplyStream.flushContent(state: &state, continuation: continuation)
150-
guard let lastContentBlock = state.lastContentBlock else {
150+
guard let lastContentBlock = state.lastContentBlock else {
151151
fatalError(
152152
String(
153153
"ContentBlockStop received but no content block was buffered for block ID \(blockId)"
@@ -158,7 +158,7 @@ public struct ConverseReplyStream: Sendable {
158158
if case .toolUse(let toolUse) = lastContentBlock.1 {
159159
continuation.yield(.toolUse(blockId, toolUse))
160160
}
161-
// buffer this content block
161+
// buffer this content block
162162
state.contentBlocks[blockId] = lastContentBlock.1
163163

164164
// reset the current block ID

Tests/ConverseStream/ConverseReplyGenerator.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ extension ConverseReplyStreamTests {
115115
}
116116
}
117117

118-
// Helper function to create a never-ending stream that will continue indefinitely
118+
// Helper function to create a never-ending stream that will continue indefinitely
119119
func createNeverEndingStream() -> AsyncThrowingStream<BedrockRuntimeClientTypes.ConverseStreamOutput, Error> {
120120
AsyncThrowingStream<BedrockRuntimeClientTypes.ConverseStreamOutput, Error> { continuation in
121121
// Message start
@@ -159,5 +159,5 @@ extension ConverseReplyStreamTests {
159159
continuousTask.cancel()
160160
}
161161
}
162-
}
163-
}
162+
}
163+
}

Tests/ConverseStream/ConverseReplyStreamTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct ConverseReplyStreamTests {
2929
bedrockRuntimeClient: MockBedrockRuntimeClient()
3030
)
3131
}
32-
32+
3333
@Test("Test streaming text response")
3434
func testStreamingTextResponse() async throws {
3535
// Create the ConverseReplyStream from the simulated stream
@@ -110,7 +110,6 @@ struct ConverseReplyStreamTests {
110110
} else {
111111
Issue.record("Expected contentBlockComplete")
112112
}
113-
114113

115114
// Check message complete
116115
if case .messageComplete(let message) = streamElements[3] {

Tests/ConverseStream/MockBedrockRuntimeClient+StreamGenerator.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extension MockBedrockRuntimeClient {
8282

8383
continuation.finish()
8484
}
85-
}
85+
}
8686

8787
package func getToolUseStream(
8888
for toolName: String
@@ -219,5 +219,5 @@ extension MockBedrockRuntimeClient {
219219

220220
continuation.finish()
221221
}
222-
}
223-
}
222+
}
223+
}

0 commit comments

Comments
 (0)