Skip to content

Commit f8223ee

Browse files
committed
backend: renaming
1 parent e4d0342 commit f8223ee

File tree

62 files changed

+146
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+146
-134
lines changed

backend/Package.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,35 @@ let package = Package(
2121
.executableTarget(
2222
name: "App",
2323
dependencies: [
24-
.target(name: "SwiftBedrockService"),
24+
.target(name: "BedrockService"),
2525
.product(name: "ArgumentParser", package: "swift-argument-parser"),
2626
.product(name: "Hummingbird", package: "hummingbird"),
2727
],
2828
path: "Sources/App"
2929
),
3030
.target(
31-
name: "SwiftBedrockService",
31+
name: "BedrockService",
3232
dependencies: [
33-
.target(name: "SwiftBedrockTypes"),
33+
.target(name: "BedrockTypes"),
3434
.product(name: "AWSClientRuntime", package: "aws-sdk-swift"),
3535
.product(name: "AWSBedrock", package: "aws-sdk-swift"),
3636
.product(name: "AWSBedrockRuntime", package: "aws-sdk-swift"),
3737
.product(name: "Smithy", package: "smithy-swift"),
3838
.product(name: "Logging", package: "swift-log"),
3939
],
40-
path: "Sources/SwiftBedrockService"
40+
path: "Sources/BedrockService"
4141
),
4242
.target(
43-
name: "SwiftBedrockTypes",
44-
path: "Sources/SwiftBedrockTypes"
43+
name: "BedrockTypes",
44+
path: "Sources/BedrockTypes"
4545
),
4646
.testTarget(
47-
name: "SwiftBedrockServiceTests",
47+
name: "BedrockServiceTests",
4848
dependencies: [
49-
.target(name: "SwiftBedrockService"),
49+
.target(name: "BedrockService"),
5050
.product(name: "Testing", package: "swift-testing"),
5151
],
52-
path: "Tests/SwiftBedrockServiceTests"
52+
path: "Tests/BedrockServiceTests"
5353
),
5454
// .testTarget(name: "AppTests",
5555
// dependencies: [

backend/Sources/App/Application+build.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
import Hummingbird
1717
import Logging
18-
import SwiftBedrockService
19-
import SwiftBedrockTypes
18+
import BedrockService
19+
import BedrockTypes
2020

2121
/// Application arguments protocol. We use a protocol so we can call
2222
/// `buildApplication` inside Tests as well as in the App executable.
@@ -75,7 +75,7 @@ func buildRouter(useSSO: Bool, logger: Logger) async throws -> Router<AppRequest
7575
}
7676

7777
// SwiftBedrock
78-
let bedrock = try await SwiftBedrock(useSSO: useSSO)
78+
let bedrock = try await BedrockService(useSSO: useSSO)
7979

8080
// List models
8181
// GET /foundation-models lists all models

backend/Sources/App/Types/Chat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import Foundation
1717
import Hummingbird
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
extension Message: ResponseCodable {}
2121

backend/Sources/App/Types/ImageGeneration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import Foundation
1717
import Hummingbird
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
extension ImageGenerationOutput: ResponseCodable {}
2121

backend/Sources/App/Types/ListModels.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
import Foundation
1717
import Hummingbird
18-
import SwiftBedrockService
18+
import BedrockService
1919

2020
extension ModelSummary: ResponseEncodable {}

backend/Sources/App/Types/TextGeneration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import Foundation
1717
import Hummingbird
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
extension TextCompletion: ResponseCodable {}
2121

backend/Sources/SwiftBedrockService/Converse/ConverseRequest.swift renamed to backend/Sources/BedrockService/Converse/ConverseRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@preconcurrency import AWSBedrockRuntime
1717
import Foundation
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
public struct ConverseRequest {
2121
let model: BedrockModel

backend/Sources/SwiftBedrockService/Converse/ConverseResponse.swift renamed to backend/Sources/BedrockService/Converse/ConverseResponse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515

1616
@preconcurrency import AWSBedrockRuntime
1717
import Foundation
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
public struct ConverseResponse {
2121
let message: Message
2222

2323
public init(_ output: BedrockRuntimeClientTypes.ConverseOutput) throws {
2424
guard case .message(let sdkMessage) = output else {
25-
throw SwiftBedrockError.invalidSDKResponse("Could not extract message from ConverseOutput")
25+
throw BedrockServiceError.invalidSDKResponse("Could not extract message from ConverseOutput")
2626
}
2727
self.message = try Message(from: sdkMessage)
2828
}

backend/Sources/SwiftBedrockService/Converse/ConversionExtensions.swift renamed to backend/Sources/BedrockService/Converse/ConversionExtensions.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515

1616
@preconcurrency import AWSBedrockRuntime
1717
import Foundation
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
extension Message {
2121

2222
init(from sdkMessage: BedrockRuntimeClientTypes.Message) throws {
2323
guard let sdkRole = sdkMessage.role else {
24-
throw SwiftBedrockError.decodingError("Could not extract role from BedrockRuntimeClientTypes.Message")
24+
throw BedrockServiceError.decodingError("Could not extract role from BedrockRuntimeClientTypes.Message")
2525
}
2626
guard let sdkContent = sdkMessage.content else {
27-
throw SwiftBedrockError.decodingError("Could not extract content from BedrockRuntimeClientTypes.Message")
27+
throw BedrockServiceError.decodingError("Could not extract content from BedrockRuntimeClientTypes.Message")
2828
}
2929
let content: [Content] = try sdkContent.map { try Content(from: $0) }
3030
self = Message(from: try Role(from: sdkRole), content: content)
@@ -49,11 +49,11 @@ extension Content {
4949
case .text(let text):
5050
self = .text(text)
5151
case .sdkUnknown(let unknownContentBlock):
52-
throw SwiftBedrockError.notImplemented(
52+
throw BedrockServiceError.notImplemented(
5353
"ContentBlock \(unknownContentBlock) is not implemented by BedrockRuntimeClientTypes"
5454
)
5555
default:
56-
throw SwiftBedrockError.notImplemented(
56+
throw BedrockServiceError.notImplemented(
5757
"\(sdkContentBlock.self) is not implemented by this library"
5858
)
5959
}
@@ -73,7 +73,7 @@ extension Role {
7373
case .user: self = .user
7474
case .assistant: self = .assistant
7575
case .sdkUnknown(let unknownRole):
76-
throw SwiftBedrockError.notImplemented(
76+
throw BedrockServiceError.notImplemented(
7777
"Role \(unknownRole) is not implemented by BedrockRuntimeClientTypes"
7878
)
7979
}

backend/Sources/SwiftBedrockService/InvokeModel/InvokeModelRequest.swift renamed to backend/Sources/BedrockService/InvokeModel/InvokeModelRequest.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@preconcurrency import AWSBedrockRuntime
1717
import Foundation
18-
import SwiftBedrockTypes
18+
import BedrockTypes
1919

2020
struct InvokeModelRequest {
2121
let model: BedrockModel
@@ -43,7 +43,7 @@ struct InvokeModelRequest {
4343
/// - maxTokens: Maximum number of tokens to generate (default: 300)
4444
/// - temperature: Temperature for text generation (default: 0.6)
4545
/// - Returns: A configured BedrockRequest for a text request
46-
/// - Throws: SwiftBedrockError if the model doesn't support text output
46+
/// - Throws: BedrockServiceError if the model doesn't support text output
4747
static func createTextRequest(
4848
model: BedrockModel,
4949
prompt: String,
@@ -92,7 +92,7 @@ struct InvokeModelRequest {
9292
/// - prompt: The text description of the image to generate
9393
/// - nrOfImages: The number of images to generate
9494
/// - Returns: A configured BedrockRequest for image generation
95-
/// - Throws: SwiftBedrockError if the model doesn't support text input or image output
95+
/// - Throws: BedrockServiceError if the model doesn't support text input or image output
9696
public static func createTextToImageRequest(
9797
model: BedrockModel,
9898
prompt: String,
@@ -149,7 +149,7 @@ struct InvokeModelRequest {
149149
/// - similarity: A value between 0 and 1 indicating how similar the variations should be to the source image
150150
/// - nrOfImages: The number of image variations to generate
151151
/// - Returns: A configured BedrockRequest for image variation generation
152-
/// - Throws: SwiftBedrockError if the model doesn't support text and image input, or image output
152+
/// - Throws: BedrockServiceError if the model doesn't support text and image input, or image output
153153
public static func createImageVariationRequest(
154154
model: BedrockModel,
155155
prompt: String,
@@ -205,7 +205,7 @@ struct InvokeModelRequest {
205205

206206
/// Creates an InvokeModelInput instance for making a request to Amazon Bedrock
207207
/// - Returns: A configured InvokeModelInput containing the model ID, content type, and encoded request body
208-
/// - Throws: SwiftBedrockError.encodingError if the request body cannot be encoded to JSON
208+
/// - Throws: BedrockServiceError.encodingError if the request body cannot be encoded to JSON
209209
public func getInvokeModelInput() throws -> InvokeModelInput {
210210
do {
211211
let jsonData: Data = try JSONEncoder().encode(self.body)
@@ -216,7 +216,7 @@ struct InvokeModelRequest {
216216
modelId: model.id
217217
)
218218
} catch {
219-
throw SwiftBedrockError.encodingError(
219+
throw BedrockServiceError.encodingError(
220220
"Something went wrong while encoding the request body to JSON for InvokeModelInput: \(error)"
221221
)
222222
}

0 commit comments

Comments
 (0)