Skip to content

Commit 30d3f82

Browse files
committed
Merge branch 'main' into sebsto/jsonvalue
2 parents adf26a5 + abad720 commit 30d3f82

File tree

7 files changed

+34
-8
lines changed

7 files changed

+34
-8
lines changed

.github/workflows/integration_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Integration Tests
22

3+
permissions: read-all
4+
35
on:
46
workflow_call:
57
inputs:

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Build, tests & soundness checks
22

33
on: [pull_request, workflow_dispatch]
44

5+
permissions: read-all
6+
57
jobs:
68
swift-bedrock-library-build:
79
runs-on: ubuntu-latest

.github/workflows/swift-6-language-mode.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Swift 6 language mode
22

3+
permissions: read-all
4+
35
on:
46
workflow_call:
57

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ let package = Package(
1111
],
1212
dependencies: [
1313
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.6.1"),
14-
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.5.16"),
15-
.package(url: "https://github.com/smithy-lang/smithy-swift", from: "0.152.0"),
14+
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.5.51"),
15+
.package(url: "https://github.com/smithy-lang/smithy-swift", from: "0.158.0"),
1616
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.4"),
17-
.package(url: "https://github.com/awslabs/aws-crt-swift", from: "0.52.1"),
17+
.package(url: "https://github.com/awslabs/aws-crt-swift", from: "0.53.0"),
1818
],
1919
targets: [
2020
.target(

Sources/Converse/ContentBlocks/JSON.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ public struct JSON: Codable, Sendable {
133133
public let value: JSONValue
134134

135135
public subscript<T>(key: String) -> T? {
136-
value[key]
136+
get {
137+
value[key]
138+
}
137139
}
138140

139141
public subscript(key: String) -> JSONValue? {

Sources/Models/Anthropic/AnthropicBedrockModels.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ typealias ClaudeV3_5Sonnet = AnthropicText
3030
typealias ClaudeV3_7Sonnet = AnthropicText
3131
typealias Claude_Sonnet_v4 = AnthropicText
3232
typealias Claude_Opus_v4 = AnthropicText
33+
typealias Claude_Sonnet_v4_5 = AnthropicText
3334

3435
// text
3536
// https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-anthropic-claude-messages.html
@@ -219,4 +220,20 @@ extension BedrockModel {
219220
maxReasoningTokens: Parameter(.maxReasoningTokens, minValue: 1_024, maxValue: 8_191, defaultValue: 4_096)
220221
)
221222
)
223+
public static let claude_sonnet_v4_5: BedrockModel = BedrockModel(
224+
id: "anthropic.claude-sonnet-4-5-20250929-v1:0",
225+
name: "Claude Sonnet v4.5",
226+
modality: Claude_Sonnet_v4_5(
227+
parameters: TextGenerationParameters(
228+
temperature: Parameter(.temperature, minValue: 0, maxValue: 1, defaultValue: 1),
229+
maxTokens: Parameter(.maxTokens, minValue: 1, maxValue: 64_000, defaultValue: 8_192),
230+
topP: Parameter(.topP, minValue: 0, maxValue: 1, defaultValue: 0.999),
231+
topK: Parameter(.topK, minValue: 0, maxValue: 500, defaultValue: 0),
232+
stopSequences: StopSequenceParams(maxSequences: 8191, defaultValue: []),
233+
maxPromptSize: 200_000
234+
),
235+
features: [.textGeneration, .systemPrompts, .document, .vision, .toolUse, .reasoning],
236+
maxReasoningTokens: Parameter(.maxReasoningTokens, minValue: 1_024, maxValue: 8_191, defaultValue: 4_096)
237+
)
238+
)
222239
}

Tests/Converse/JSONTests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct JSONTests {
5656
#expect(json["address"]?["isSomething"] == true)
5757
#expect(json["nonExistentKey"] == nil)
5858
}
59-
//
59+
6060
@Test("JSON Subscript")
6161
func jsonSubscript() async throws {
6262
let json = try JSON(
@@ -71,7 +71,8 @@ struct JSONTests {
7171
#expect(json["name"] == "Jane Doe")
7272
#expect(json["age"] == 30)
7373
#expect(json["isMember"] == true)
74-
#expect(json["nonExistentKey"] == nil)
74+
let t: String? = json["nonExistentKey"]
75+
#expect(t == nil)
7576
}
7677

7778
@Test("JSON Subscript nested")
@@ -80,7 +81,8 @@ struct JSONTests {
8081
#expect(json["name"] == "Jane Doe")
8182
#expect(json["age"] == 30)
8283
#expect(json["isMember"] == true)
83-
#expect(json["nonExistentKey"] == nil)
84+
let t: String? = json["nonExistentKey"]
85+
#expect(t == nil)
8486
#expect(json["address"]?["street"] == "123 Main St")
8587
#expect(json["address"]?["city"] == "Anytown")
8688
#expect(json["address"]?["state"] == "CA")
@@ -96,7 +98,6 @@ struct JSONTests {
9698
"name": "Jane Doe",
9799
"age": 30,
98100
"isMember": true,
99-
100101
""" // Note: trailing comma and no closing brace, making this invalid
101102
#expect(throws: BedrockLibraryError.self) {
102103
let _ = try JSON(from: invalidJSONString)

0 commit comments

Comments
 (0)