Skip to content

Commit ad70683

Browse files
authored
Expose max prompt size to the model API (#47)
* add sonnet 4 and 4.5 in model raw initializer * text model : expose max prompt size * swift-format
1 parent f2f1583 commit ad70683

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Sources/BedrockModel.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ public struct BedrockModel: Hashable, Sendable, Equatable, RawRepresentable {
2626
public let name: String
2727
public let modality: any Modality
2828

29+
public var maxPromptSize: Int? {
30+
guard self.hasTextModality(),
31+
let textModality = try? self.getTextModality()
32+
else { return nil }
33+
34+
return textModality.getParameters().prompt.maxSize
35+
}
36+
2937
/// Creates a new BedrockModel instance
3038
/// - Parameters:
3139
/// - id: The unique identifier for the model
@@ -66,6 +74,12 @@ public struct BedrockModel: Hashable, Sendable, Equatable, RawRepresentable {
6674
self = BedrockModel.claudev3_5_sonnet_v2
6775
case BedrockModel.claudev3_7_sonnet.id:
6876
self = BedrockModel.claudev3_7_sonnet
77+
case BedrockModel.claude_sonnet_v4.id:
78+
self = BedrockModel.claude_sonnet_v4
79+
case BedrockModel.claude_opus_v4.id:
80+
self = BedrockModel.claude_opus_v4
81+
case BedrockModel.claude_sonnet_v4_5.id:
82+
self = BedrockModel.claude_sonnet_v4_5
6983
// titan
7084
case BedrockModel.titan_text_g1_premier.id:
7185
self = BedrockModel.titan_text_g1_premier

0 commit comments

Comments
 (0)