Skip to content

Commit 12fb532

Browse files
committed
Unnecessary imports and dependencies deleted, moved snippet-ends to exclude call to function
1 parent 7488e8d commit 12fb532

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

swift/example_code/bedrock-runtime/models/amazon-nova/amazon-nova-text/Package.swift

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ let package = Package(
1515
],
1616
dependencies: [
1717
// Dependencies declare other packages that this package depends on.
18-
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
1918
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.2.61")
2019
],
2120
targets: [
@@ -25,15 +24,13 @@ let package = Package(
2524
name: "Converse",
2625
dependencies: [
2726
.product(name: "AWSBedrockRuntime", package: "aws-sdk-swift"),
28-
.product(name: "ArgumentParser", package: "swift-argument-parser")
2927
],
3028
path: "Sources/Converse"
3129
),
3230
.executableTarget(
3331
name: "ConverseStream",
3432
dependencies: [
3533
.product(name: "AWSBedrockRuntime", package: "aws-sdk-swift"),
36-
.product(name: "ArgumentParser", package: "swift-argument-parser")
3734
],
3835
path: "Sources/ConverseStream"
3936
)

swift/example_code/bedrock-runtime/models/amazon-nova/amazon-nova-text/Sources/Converse/main.swift

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// snippet-start:[swift.example_code.bedrock-runtime.Converse_AmazonNovaText]
55
// An example demonstrating how to use the Conversation API to send a text message to Amazon Nova.
66

7-
import ArgumentParser
8-
import AWSClientRuntime
9-
import Foundation
107
import AWSBedrockRuntime
118

129
func converse(_ textPrompt: String) async throws -> String {
@@ -50,11 +47,11 @@ func converse(_ textPrompt: String) async throws -> String {
5047
}
5148
}
5249

50+
// snippet-end:[swift.example_code.bedrock-runtime.Converse_AmazonNovaText]
51+
5352
do {
5453
let reply = try await converse("Describe the purpose of a 'hello world' program in one line.")
5554
print(reply)
5655
} catch {
5756
print("An error occured: \(error)")
5857
}
59-
60-
// snippet-end:[swift.example_code.bedrock-runtime.Converse_AmazonNovaText]

swift/example_code/bedrock-runtime/models/amazon-nova/amazon-nova-text/Sources/ConverseStream/main.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
// snippet-start:[swift.example_code.bedrock-runtime.ConverseStream_AmazonNovaText]
55
// An example demonstrating how to use the Conversation API to send a text message to Amazon Nova and print the response stream
66

7-
import ArgumentParser
8-
import AWSClientRuntime
9-
import Foundation
107
import AWSBedrockRuntime
118

129
func printConverseStream(_ textPrompt: String) async throws {
1310

1411
// Create a Bedrock Runtime client in the AWS Region you want to use.
15-
let config = try await BedrockRuntimeClient.BedrockRuntimeClientConfiguration(region: "us-east-1")
12+
let config = try await BedrockRuntimeClient.BedrockRuntimeClientConfiguration(region: "us-east-1")
1613
let client = BedrockRuntimeClient(config: config)
1714

1815
// Set the model ID.
@@ -61,10 +58,10 @@ func printConverseStream(_ textPrompt: String) async throws {
6158
}
6259
}
6360

61+
// snippet-end:[swift.example_code.bedrock-runtime.ConverseStream_AmazonNovaText]
62+
6463
do {
6564
try await printConverseStream("Describe the purpose of a 'hello world' program in two paragraphs.")
6665
} catch {
6766
print("An error occured: \(error)")
6867
}
69-
70-
// snippet-end:[swift.example_code.bedrock-runtime.ConverseStream_AmazonNovaText]

0 commit comments

Comments
 (0)