@effect/ai-amazon-bedrock 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/AmazonBedrockClient/package.json +6 -0
  2. package/AmazonBedrockConfig/package.json +6 -0
  3. package/AmazonBedrockLanguageModel/package.json +6 -0
  4. package/AmazonBedrockSchema/package.json +6 -0
  5. package/EventStreamEncoding/package.json +6 -0
  6. package/LICENSE +21 -0
  7. package/README.md +5 -0
  8. package/dist/cjs/AmazonBedrockClient.js +255 -0
  9. package/dist/cjs/AmazonBedrockClient.js.map +1 -0
  10. package/dist/cjs/AmazonBedrockConfig.js +30 -0
  11. package/dist/cjs/AmazonBedrockConfig.js.map +1 -0
  12. package/dist/cjs/AmazonBedrockLanguageModel.js +507 -0
  13. package/dist/cjs/AmazonBedrockLanguageModel.js.map +1 -0
  14. package/dist/cjs/AmazonBedrockSchema.js +745 -0
  15. package/dist/cjs/AmazonBedrockSchema.js.map +1 -0
  16. package/dist/cjs/EventStreamEncoding.js +85 -0
  17. package/dist/cjs/EventStreamEncoding.js.map +1 -0
  18. package/dist/cjs/index.js +18 -0
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/internal/utilities.js +25 -0
  21. package/dist/cjs/internal/utilities.js.map +1 -0
  22. package/dist/dts/AmazonBedrockClient.d.ts +95 -0
  23. package/dist/dts/AmazonBedrockClient.d.ts.map +1 -0
  24. package/dist/dts/AmazonBedrockConfig.d.ts +47 -0
  25. package/dist/dts/AmazonBedrockConfig.d.ts.map +1 -0
  26. package/dist/dts/AmazonBedrockLanguageModel.d.ts +95 -0
  27. package/dist/dts/AmazonBedrockLanguageModel.d.ts.map +1 -0
  28. package/dist/dts/AmazonBedrockSchema.d.ts +1434 -0
  29. package/dist/dts/AmazonBedrockSchema.d.ts.map +1 -0
  30. package/dist/dts/EventStreamEncoding.d.ts +16 -0
  31. package/dist/dts/EventStreamEncoding.d.ts.map +1 -0
  32. package/dist/dts/index.d.ts +21 -0
  33. package/dist/dts/index.d.ts.map +1 -0
  34. package/dist/dts/internal/utilities.d.ts +2 -0
  35. package/dist/dts/internal/utilities.d.ts.map +1 -0
  36. package/dist/esm/AmazonBedrockClient.js +242 -0
  37. package/dist/esm/AmazonBedrockClient.js.map +1 -0
  38. package/dist/esm/AmazonBedrockConfig.js +22 -0
  39. package/dist/esm/AmazonBedrockConfig.js.map +1 -0
  40. package/dist/esm/AmazonBedrockLanguageModel.js +495 -0
  41. package/dist/esm/AmazonBedrockLanguageModel.js.map +1 -0
  42. package/dist/esm/AmazonBedrockSchema.js +675 -0
  43. package/dist/esm/AmazonBedrockSchema.js.map +1 -0
  44. package/dist/esm/EventStreamEncoding.js +76 -0
  45. package/dist/esm/EventStreamEncoding.js.map +1 -0
  46. package/dist/esm/index.js +21 -0
  47. package/dist/esm/index.js.map +1 -0
  48. package/dist/esm/internal/utilities.js +17 -0
  49. package/dist/esm/internal/utilities.js.map +1 -0
  50. package/dist/esm/package.json +4 -0
  51. package/index/package.json +6 -0
  52. package/package.json +91 -0
  53. package/src/AmazonBedrockClient.ts +409 -0
  54. package/src/AmazonBedrockConfig.ts +78 -0
  55. package/src/AmazonBedrockLanguageModel.ts +623 -0
  56. package/src/AmazonBedrockSchema.ts +1038 -0
  57. package/src/EventStreamEncoding.ts +111 -0
  58. package/src/index.ts +24 -0
  59. package/src/internal/utilities.ts +21 -0
@@ -0,0 +1,675 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import * as Schema from "effect/Schema";
5
+ const prefix = "@effect/ai-amazon-bedrock";
6
+ const makeIdentifier = name => `${prefix}/${name}`;
7
+ /**
8
+ * The foundation models supported by Amazon Bedrock.
9
+ *
10
+ * An up-to-date list can be generated with the following command:
11
+ *
12
+ * ```sh
13
+ * aws bedrock list-foundation-models --output json | jq '[.modelSummaries[].modelId]'
14
+ * ```
15
+ *
16
+ * @since 1.0.0
17
+ * @category Schemas
18
+ */
19
+ export class BedrockFoundationModelId extends /*#__PURE__*/Schema.Literal("amazon.titan-tg1-large", "amazon.titan-image-generator-v1:0", "amazon.titan-image-generator-v1", "amazon.titan-image-generator-v2:0", "amazon.nova-premier-v1:0:8k", "amazon.nova-premier-v1:0:20k", "amazon.nova-premier-v1:0:1000k", "amazon.nova-premier-v1:0:mm", "amazon.nova-premier-v1:0", "amazon.titan-text-premier-v1:0", "amazon.nova-pro-v1:0:24k", "amazon.nova-pro-v1:0:300k", "amazon.nova-pro-v1:0", "amazon.nova-lite-v1:0:24k", "amazon.nova-lite-v1:0:300k", "amazon.nova-lite-v1:0", "amazon.nova-canvas-v1:0", "amazon.nova-reel-v1:0", "amazon.nova-reel-v1:1", "amazon.nova-micro-v1:0:24k", "amazon.nova-micro-v1:0:128k", "amazon.nova-micro-v1:0", "amazon.nova-sonic-v1:0", "amazon.titan-embed-g1-text-02", "amazon.titan-text-lite-v1:0:4k", "amazon.titan-text-lite-v1", "amazon.titan-text-express-v1:0:8k", "amazon.titan-text-express-v1", "amazon.titan-embed-text-v1:2:8k", "amazon.titan-embed-text-v1", "amazon.titan-embed-text-v2:0:8k", "amazon.titan-embed-text-v2:0", "amazon.titan-embed-image-v1:0", "amazon.titan-embed-image-v1", "stability.stable-diffusion-xl-v1:0", "stability.stable-diffusion-xl-v1", "ai21.jamba-instruct-v1:0", "ai21.jamba-1-5-large-v1:0", "ai21.jamba-1-5-mini-v1:0", "anthropic.claude-instant-v1:2:100k", "anthropic.claude-instant-v1", "anthropic.claude-v2:0:18k", "anthropic.claude-v2:0:100k", "anthropic.claude-v2:1:18k", "anthropic.claude-v2:1:200k", "anthropic.claude-v2:1", "anthropic.claude-v2", "anthropic.claude-3-sonnet-20240229-v1:0:28k", "anthropic.claude-3-sonnet-20240229-v1:0:200k", "anthropic.claude-3-sonnet-20240229-v1:0", "anthropic.claude-3-haiku-20240307-v1:0:48k", "anthropic.claude-3-haiku-20240307-v1:0:200k", "anthropic.claude-3-haiku-20240307-v1:0", "anthropic.claude-3-opus-20240229-v1:0:12k", "anthropic.claude-3-opus-20240229-v1:0:28k", "anthropic.claude-3-opus-20240229-v1:0:200k", "anthropic.claude-3-opus-20240229-v1:0", "anthropic.claude-3-5-sonnet-20240620-v1:0", "anthropic.claude-3-5-sonnet-20241022-v2:0", "anthropic.claude-3-7-sonnet-20250219-v1:0", "anthropic.claude-3-5-haiku-20241022-v1:0", "anthropic.claude-opus-4-20250514-v1:0", "anthropic.claude-sonnet-4-20250514-v1:0", "cohere.command-text-v14:7:4k", "cohere.command-text-v14", "cohere.command-r-v1:0", "cohere.command-r-plus-v1:0", "cohere.command-light-text-v14:7:4k", "cohere.command-light-text-v14", "cohere.embed-english-v3:0:512", "cohere.embed-english-v3", "cohere.embed-multilingual-v3:0:512", "cohere.embed-multilingual-v3", "deepseek.r1-v1:0", "meta.llama3-8b-instruct-v1:0", "meta.llama3-70b-instruct-v1:0", "meta.llama3-1-8b-instruct-v1:0", "meta.llama3-1-70b-instruct-v1:0", "meta.llama3-2-11b-instruct-v1:0", "meta.llama3-2-90b-instruct-v1:0", "meta.llama3-2-1b-instruct-v1:0", "meta.llama3-2-3b-instruct-v1:0", "meta.llama3-3-70b-instruct-v1:0", "meta.llama4-scout-17b-instruct-v1:0", "meta.llama4-maverick-17b-instruct-v1:0", "mistral.mistral-7b-instruct-v0:2", "mistral.mixtral-8x7b-instruct-v0:1", "mistral.mistral-large-2402-v1:0", "mistral.mistral-small-2402-v1:0", "mistral.pixtral-large-2502-v1:0") {}
20
+ /**
21
+ * @since 1.0.0
22
+ * @category Schemas
23
+ */
24
+ export class CachePointBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("CachePointBlock"))({
25
+ type: /*#__PURE__*/Schema.Literal("default")
26
+ }) {}
27
+ /**
28
+ * @since 1.0.0
29
+ * @category Schemas
30
+ */
31
+ export const DocumentFormat = /*#__PURE__*/Schema.Literal("csv", "doc", "docx", "html", "md", "pdf", "txt", "xls", "xlsx");
32
+ /**
33
+ * @since 1.0.0
34
+ * @category Schemas
35
+ */
36
+ export class DocumentBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("DocumentBlock"))({
37
+ name: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9()[\]-]+(?: [a-zA-Z0-9()[\]-]+)*$/), /*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(200)),
38
+ format: DocumentFormat,
39
+ source: /*#__PURE__*/Schema.Struct({
40
+ bytes: Schema.NonEmptyString
41
+ })
42
+ }) {}
43
+ /**
44
+ * @since 1.0.0
45
+ * @category Schemas
46
+ */
47
+ export class GuardrailConverseImageBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailConverseImageBlock"))({
48
+ format: /*#__PURE__*/Schema.Literal("png", "jpg"),
49
+ source: /*#__PURE__*/Schema.Struct({
50
+ bytes: Schema.NonEmptyString
51
+ })
52
+ }) {}
53
+ /**
54
+ * @since 1.0.0
55
+ * @category Schemas
56
+ */
57
+ export class GuardrailConverseTextBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailConverseTextBlock"))({
58
+ text: Schema.String,
59
+ qualifiers: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Literal("guard_content", "grounding_source", "query")))
60
+ }) {}
61
+ /**
62
+ * @since 1.0.0
63
+ * @category Schemas
64
+ */
65
+ export class GuardrailConverseContentBlock extends /*#__PURE__*/Schema.Union(GuardrailConverseImageBlock, GuardrailConverseTextBlock) {}
66
+ /**
67
+ * @since 1.0.0
68
+ * @category Schemas
69
+ */
70
+ export const ImageFormat = /*#__PURE__*/Schema.Literal("gif", "jpeg", "png", "webp");
71
+ /**
72
+ * @since 1.0.0
73
+ * @category Schemas
74
+ */
75
+ export class ImageBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ImageBlock"))({
76
+ format: ImageFormat,
77
+ source: /*#__PURE__*/Schema.Struct({
78
+ bytes: Schema.NonEmptyString
79
+ })
80
+ }) {}
81
+ /**
82
+ * @since 1.0.0
83
+ * @category Schemas
84
+ */
85
+ export class JsonBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("JsonBlock"))({
86
+ json: Schema.Unknown
87
+ }) {}
88
+ /**
89
+ * @since 1.0.0
90
+ * @category Schemas
91
+ */
92
+ export class ReasoningContentBlock extends /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
93
+ reasoningText: /*#__PURE__*/Schema.Struct({
94
+ text: Schema.String,
95
+ signature: /*#__PURE__*/Schema.optional(Schema.String)
96
+ })
97
+ }), /*#__PURE__*/Schema.Struct({
98
+ redactedContent: Schema.Uint8ArrayFromBase64
99
+ })) {}
100
+ /**
101
+ * @since 1.0.0
102
+ * @category Schemas
103
+ */
104
+ export class VideoBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("VideoBlock"))({
105
+ format: /*#__PURE__*/Schema.Literal("flv", "mkv", "mov", "mp4", "mpg", "mpeg", "three_gp", "webm"),
106
+ source: /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
107
+ bytes: Schema.NonEmptyString
108
+ }), /*#__PURE__*/Schema.Struct({
109
+ s3Location: /*#__PURE__*/Schema.Struct({
110
+ uri: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^s3:\/\/[a-z0-9][.\-a-z0-9]{1,61}[a-z0-9](\/.*)?$/), /*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(1024)),
111
+ bucketOwner: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^[0-9]{12}$/), Schema.optional)
112
+ })
113
+ }))
114
+ }) {}
115
+ /**
116
+ * @since 1.0.0
117
+ * @category Schemas
118
+ */
119
+ export class ToolResultBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolResultBlock"))({
120
+ content: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
121
+ document: DocumentBlock
122
+ }), /*#__PURE__*/Schema.Struct({
123
+ image: ImageBlock
124
+ }), /*#__PURE__*/Schema.Struct({
125
+ text: Schema.String
126
+ }), /*#__PURE__*/Schema.Struct({
127
+ json: JsonBlock
128
+ }), /*#__PURE__*/Schema.Struct({
129
+ video: VideoBlock
130
+ }))),
131
+ toolUseId: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/), /*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64)),
132
+ status: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literal("success", "error"))
133
+ }) {}
134
+ /**
135
+ * @since 1.0.0
136
+ * @category Schemas
137
+ */
138
+ export class ToolUseBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolUseBlock"))({
139
+ name: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/), /*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64)),
140
+ input: Schema.Unknown,
141
+ toolUseId: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/), /*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64))
142
+ }) {}
143
+ /**
144
+ * @since 1.0.0
145
+ * @category Schemas
146
+ */
147
+ export class ContentBlock extends /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
148
+ cachePoint: CachePointBlock
149
+ }), /*#__PURE__*/Schema.Struct({
150
+ document: DocumentBlock
151
+ }), /*#__PURE__*/Schema.Struct({
152
+ guardContent: GuardrailConverseContentBlock
153
+ }), /*#__PURE__*/Schema.Struct({
154
+ image: ImageBlock
155
+ }), /*#__PURE__*/Schema.Struct({
156
+ reasoningContent: ReasoningContentBlock
157
+ }), /*#__PURE__*/Schema.Struct({
158
+ text: Schema.String
159
+ }), /*#__PURE__*/Schema.Struct({
160
+ toolResult: ToolResultBlock
161
+ }), /*#__PURE__*/Schema.Struct({
162
+ toolUse: ToolUseBlock
163
+ }), /*#__PURE__*/Schema.Struct({
164
+ video: VideoBlock
165
+ })) {}
166
+ /**
167
+ * @since 1.0.0
168
+ * @category Schemas
169
+ */
170
+ export class Message extends /*#__PURE__*/Schema.Class(makeIdentifier("Message"))({
171
+ role: /*#__PURE__*/Schema.Literal("user", "assistant"),
172
+ content: /*#__PURE__*/Schema.Array(ContentBlock)
173
+ }) {}
174
+ /**
175
+ * @since 1.0.0
176
+ * @category Schemas
177
+ */
178
+ export class ConverseOutput extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseOutput"))({
179
+ message: Message
180
+ }) {}
181
+ /**
182
+ * @since 1.0.0
183
+ * @category Schemas
184
+ */
185
+ export class ConverseMetrics extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseMetrics"))({
186
+ latencyMs: Schema.DurationFromMillis
187
+ }) {}
188
+ /**
189
+ * @since 1.0.0
190
+ * @category Schemas
191
+ */
192
+ export class GuardrailContentFilter extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailContentFilter"))({
193
+ type: /*#__PURE__*/Schema.Literal("HATE", "INSULTS", "MISCONDUCT", "PROMPT_ATTACK", "SEXUAL", "VIOLENCE"),
194
+ action: /*#__PURE__*/Schema.Literal("BLOCKED", "NONE"),
195
+ confidence: /*#__PURE__*/Schema.Literal("NONE", "LOW", "MEDIUM", "HIGH"),
196
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean),
197
+ filterStrength: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literal("NONE", "LOW", "MEDIUM", "HIGH"))
198
+ }) {}
199
+ /**
200
+ * @since 1.0.0
201
+ * @category Schemas
202
+ */
203
+ export class GuardrailContentPolicyAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailContentPolicyAssessment"))({
204
+ filters: /*#__PURE__*/Schema.Array(GuardrailContentFilter)
205
+ }) {}
206
+ /**
207
+ * @since 1.0.0
208
+ * @category Schemas
209
+ */
210
+ export class GuardrailContextualGroundingFilter extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailContextualGroundingFilter"))({
211
+ type: /*#__PURE__*/Schema.Literal("GROUNDING", "RELEVANCE"),
212
+ action: /*#__PURE__*/Schema.Literal("BLOCKED", "NONE"),
213
+ score: /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.between(0, 1)),
214
+ threshold: /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.between(0, 1)),
215
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean)
216
+ }) {}
217
+ /**
218
+ * @since 1.0.0
219
+ * @category Schemas
220
+ */
221
+ export class GuardrailContextualGroundingPolicyAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailContextualGroundingPolicyAssessment"))({
222
+ filters: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(GuardrailContextualGroundingFilter))
223
+ }) {}
224
+ /**
225
+ * @since 1.0.0
226
+ * @category Schemas
227
+ */
228
+ export class GuardrailImageCoverage extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailImageCoverage"))({
229
+ guarded: /*#__PURE__*/Schema.optional(Schema.Int),
230
+ total: /*#__PURE__*/Schema.optional(Schema.Int)
231
+ }) {}
232
+ /**
233
+ * @since 1.0.0
234
+ * @category Schemas
235
+ */
236
+ export class GuardrailTextCharactersCoverage extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailTextCharactersCoverage"))({
237
+ guarded: /*#__PURE__*/Schema.optional(Schema.Int),
238
+ total: /*#__PURE__*/Schema.optional(Schema.Int)
239
+ }) {}
240
+ /**
241
+ * @since 1.0.0
242
+ * @category Schemas
243
+ */
244
+ export class GuardrailCoverage extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailCoverage"))({
245
+ images: /*#__PURE__*/Schema.optional(GuardrailImageCoverage),
246
+ textCharacters: /*#__PURE__*/Schema.optional(GuardrailTextCharactersCoverage)
247
+ }) {}
248
+ /**
249
+ * @since 1.0.0
250
+ * @category Schemas
251
+ */
252
+ export class GuardrailUsage extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailUsage"))({
253
+ contentPolicyUnits: Schema.Int,
254
+ contextualGroundingPolicyUnits: Schema.Int,
255
+ sensitiveInformationPolicyFreeUnits: Schema.Int,
256
+ sensitiveInformationPolicyUnits: Schema.Int,
257
+ topicPolicyUnits: Schema.Int,
258
+ wordPolicyUnits: Schema.Int,
259
+ contentPolicyImageUnits: /*#__PURE__*/Schema.optional(Schema.Int)
260
+ }) {}
261
+ /**
262
+ * @since 1.0.0
263
+ * @category Schemas
264
+ */
265
+ export class GuardrailInvocationMetrics extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailInvocationMetrics"))({
266
+ guardrailCoverage: /*#__PURE__*/Schema.optional(GuardrailCoverage),
267
+ guardrailProcessingLatency: /*#__PURE__*/Schema.optional(Schema.Number),
268
+ usage: /*#__PURE__*/Schema.optional(GuardrailUsage)
269
+ }) {}
270
+ /**
271
+ * @since 1.0.0
272
+ * @category Schemas
273
+ */
274
+ export class GuardrailPiiEntityFilter extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailPiiEntityFilter"))({
275
+ type: /*#__PURE__*/Schema.Literal("ADDRESS", "AGE", "AWS_ACCESS_KEY", "AWS_SECRET_KEY", "CA_HEALTH_NUMBER", "CA_SOCIAL_INSURANCE_NUMBER", "CREDIT_DEBIT_CARD_CVV", "CREDIT_DEBIT_CARD_EXPIRY", "CREDIT_DEBIT_CARD_NUMBER", "DRIVER_ID", "EMAIL", "INTERNATIONAL_BANK_ACCOUNT_NUMBER", "IP_ADDRESS", "LICENSE_PLATE", "MAC_ADDRESS", "NAME", "PASSWORD", "PHONE", "PIN", "SWIFT_CODE", "UK_NATIONAL_HEALTH_SERVICE_NUMBER", "UK_NATIONAL_INSURANCE_NUMBER", "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER", "URL", "USERNAME", "US_BANK_ACCOUNT_NUMBER", "US_BANK_ROUTING_NUMBER", "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER", "US_PASSPORT_NUMBER", "US_SOCIAL_SECURITY_NUMBER", "VEHICLE_IDENTIFICATION_NUMBER"),
276
+ action: /*#__PURE__*/Schema.Literal("ANONYMIZED", "BLOCKED", "NONE"),
277
+ match: Schema.String,
278
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean)
279
+ }) {}
280
+ /**
281
+ * @since 1.0.0
282
+ * @category Schemas
283
+ */
284
+ export class GuardrailRegexFilter extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailRegexFilter"))({
285
+ action: /*#__PURE__*/Schema.Literal("ANONYMIZED", "BLOCKED", "NONE"),
286
+ name: /*#__PURE__*/Schema.optional(Schema.String),
287
+ match: /*#__PURE__*/Schema.optional(Schema.String),
288
+ regex: /*#__PURE__*/Schema.optional(Schema.String),
289
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean)
290
+ }) {}
291
+ /**
292
+ * @since 1.0.0
293
+ * @category Schemas
294
+ */
295
+ export class GuardrailSensitiveInformationPolicyAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailSensitiveInformationPolicyAssessment"))({
296
+ piiEntities: /*#__PURE__*/Schema.Array(GuardrailPiiEntityFilter),
297
+ regexes: /*#__PURE__*/Schema.Array(GuardrailRegexFilter)
298
+ }) {}
299
+ /**
300
+ * @since 1.0.0
301
+ * @category Schemas
302
+ */
303
+ export class GuardrailTopic extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailTopic"))({
304
+ action: /*#__PURE__*/Schema.Literal("BLOCKED", "NONE"),
305
+ name: Schema.String,
306
+ type: /*#__PURE__*/Schema.Literal("DENY"),
307
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean)
308
+ }) {}
309
+ /**
310
+ * @since 1.0.0
311
+ * @category Schemas
312
+ */
313
+ export class GuardrailTopicPolicyAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailTopicPolicyAssessment"))({
314
+ topics: /*#__PURE__*/Schema.Array(GuardrailTopic)
315
+ }) {}
316
+ /**
317
+ * @since 1.0.0
318
+ * @category Schemas
319
+ */
320
+ export class GuardrailCustomWord extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailCustomWord"))({
321
+ action: /*#__PURE__*/Schema.Literal("BLOCKED", "NONE"),
322
+ match: Schema.String,
323
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean)
324
+ }) {}
325
+ /**
326
+ * @since 1.0.0
327
+ * @category Schemas
328
+ */
329
+ export class GuardrailManagedWord extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailManagedWord"))({
330
+ action: /*#__PURE__*/Schema.Literal("BLOCKED", "NONE"),
331
+ match: Schema.String,
332
+ type: /*#__PURE__*/Schema.Literal("PROFANITY"),
333
+ detected: /*#__PURE__*/Schema.optional(Schema.Boolean)
334
+ }) {}
335
+ /**
336
+ * @since 1.0.0
337
+ * @category Schemas
338
+ */
339
+ export class GuardrailWordPolicyAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailWordPolicyAssessment"))({
340
+ customWords: GuardrailCustomWord,
341
+ managedWordLists: GuardrailManagedWord
342
+ }) {}
343
+ /**
344
+ * @since 1.0.0
345
+ * @category Schemas
346
+ */
347
+ export class GuardrailAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailAssessment"))({
348
+ contentPolicy: /*#__PURE__*/Schema.optional(GuardrailContentPolicyAssessment),
349
+ contextualGroundingPolicy: /*#__PURE__*/Schema.optional(GuardrailContextualGroundingPolicyAssessment),
350
+ invocationMetrics: /*#__PURE__*/Schema.optional(GuardrailInvocationMetrics),
351
+ sensitiveInformationPolicy: /*#__PURE__*/Schema.optional(GuardrailSensitiveInformationPolicyAssessment),
352
+ topicPolicy: /*#__PURE__*/Schema.optional(GuardrailTopicPolicyAssessment),
353
+ wordPolicy: /*#__PURE__*/Schema.optional(GuardrailWordPolicyAssessment)
354
+ }) {}
355
+ /**
356
+ * @since 1.0.0
357
+ * @category Schemas
358
+ */
359
+ export class GuardrailTraceAssessment extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailTraceAssessment"))({
360
+ actionReason: /*#__PURE__*/Schema.optional(Schema.String),
361
+ inputAssessment: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
362
+ key: Schema.String,
363
+ value: GuardrailAssessment
364
+ })),
365
+ modelOutput: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String)),
366
+ outputAssessments: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
367
+ key: Schema.String,
368
+ value: GuardrailAssessment
369
+ }))
370
+ }) {}
371
+ /**
372
+ * @since 1.0.0
373
+ * @category Schemas
374
+ */
375
+ export class PromptRouterTrace extends /*#__PURE__*/Schema.Class(makeIdentifier("PromptRouterTrace"))({
376
+ invokedModelId: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}::foundation-model\/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([a-z0-9-]{1,63}[.]){0,2}[a-z0-9-]{1,63}([:][a-z0-9-]{1,63}){0,2})|(arn:aws(|-us-gov|-cn|-iso|-iso-b):bedrock:(|[0-9a-z-]{1,20}):(|[0-9]{12}):inference-profile\/[a-zA-Z0-9-:.]+)$/), Schema.optional)
377
+ }) {}
378
+ /**
379
+ * @since 1.0.0
380
+ * @category Schemas
381
+ */
382
+ export class ConverseTrace extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseTrace"))({
383
+ guardrail: /*#__PURE__*/Schema.optional(GuardrailTraceAssessment),
384
+ promptRouter: /*#__PURE__*/Schema.optional(PromptRouterTrace)
385
+ }) {}
386
+ /**
387
+ * @since 1.0.0
388
+ * @category Schemas
389
+ */
390
+ export const IntZeroOrGreater = /*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0));
391
+ /**
392
+ * @since 1.0.0
393
+ * @category Schemas
394
+ */
395
+ export class TokenUsage extends /*#__PURE__*/Schema.Class(makeIdentifier("TokenUsage"))({
396
+ inputTokens: IntZeroOrGreater,
397
+ outputTokens: IntZeroOrGreater,
398
+ totalTokens: IntZeroOrGreater,
399
+ cacheReadInputTokens: /*#__PURE__*/Schema.optional(IntZeroOrGreater),
400
+ cacheWriteInputTokens: /*#__PURE__*/Schema.optional(IntZeroOrGreater)
401
+ }) {}
402
+ /**
403
+ * @since 1.0.0
404
+ * @category Schemas
405
+ */
406
+ export class SystemContentBlock extends /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
407
+ cachePoint: CachePointBlock
408
+ }), /*#__PURE__*/Schema.Struct({
409
+ guardContent: GuardrailConverseContentBlock
410
+ }), /*#__PURE__*/Schema.Struct({
411
+ text: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1))
412
+ })) {}
413
+ /**
414
+ * @since 1.0.0
415
+ * @category Schemas
416
+ */
417
+ export class GuardrailConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailConfiguration"))({
418
+ guardrailIdentifier: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(0), /*#__PURE__*/Schema.maxLength(2048), /*#__PURE__*/Schema.pattern(/^(([a-z0-9]+)|(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:guardrail\/[a-z0-9]+))$/)),
419
+ guardrailVersion: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.pattern(/^(([1-9][0-9]{0,7})|(DRAFT))$/)),
420
+ trace: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literal("enabled", "disabled", "enabled_full"))
421
+ }) {}
422
+ /**
423
+ * @since 1.0.0
424
+ * @category Schemas
425
+ */
426
+ export class InferenceConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("InferenceConfiguration"))({
427
+ maxTokens: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(1))),
428
+ stopSequences: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String.pipe(Schema.minLength(1))).pipe(/*#__PURE__*/Schema.maxItems(4))),
429
+ temperature: /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.between(0, 1)),
430
+ topP: /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.between(0, 1))
431
+ }) {}
432
+ /**
433
+ * @since 1.0.0
434
+ * @category Schemas
435
+ */
436
+ export class PerformanceConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("PerformanceConfiguration"))({
437
+ latency: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Literal("standard", "optimized"))
438
+ }) {}
439
+ /**
440
+ * @since 1.0.0
441
+ * @category Schemas
442
+ */
443
+ export class ToolSpecification extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolSpecification"))({
444
+ name: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64), /*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/)),
445
+ inputSchema: /*#__PURE__*/Schema.Struct({
446
+ json: /*#__PURE__*/Schema.Record({
447
+ key: Schema.String,
448
+ value: Schema.Unknown
449
+ })
450
+ }),
451
+ description: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1)))
452
+ }) {}
453
+ /**
454
+ * @since 1.0.0
455
+ * @category Schemas
456
+ */
457
+ export class Tool extends /*#__PURE__*/Schema.Class(makeIdentifier("Tool"))({
458
+ cachePoint: /*#__PURE__*/Schema.optional(CachePointBlock),
459
+ toolSpec: /*#__PURE__*/Schema.optional(ToolSpecification)
460
+ }) {}
461
+ /**
462
+ * @since 1.0.0
463
+ * @category Schemas
464
+ */
465
+ export class ToolChoice extends /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
466
+ any: /*#__PURE__*/Schema.Struct({})
467
+ }), /*#__PURE__*/Schema.Struct({
468
+ auto: /*#__PURE__*/Schema.Struct({})
469
+ }), /*#__PURE__*/Schema.Struct({
470
+ tool: /*#__PURE__*/Schema.Struct({
471
+ name: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64), /*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/))
472
+ })
473
+ })) {}
474
+ /**
475
+ * @since 1.0.0
476
+ * @category Schemas
477
+ */
478
+ export class ToolConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolConfiguration"))({
479
+ tools: /*#__PURE__*/Schema.Array(Tool).pipe(/*#__PURE__*/Schema.minItems(1)),
480
+ toolChoice: /*#__PURE__*/Schema.optional(ToolChoice)
481
+ }) {}
482
+ /**
483
+ * @since 1.0.0
484
+ * @category Schemas
485
+ */
486
+ export class ConverseRequest extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseRequest"))({
487
+ modelId: Schema.String,
488
+ messages: /*#__PURE__*/Schema.Array(Message),
489
+ system: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(SystemContentBlock)),
490
+ toolConfig: /*#__PURE__*/Schema.optional(ToolConfiguration),
491
+ guardrailConfig: /*#__PURE__*/Schema.optional(GuardrailConfiguration),
492
+ inferenceConfig: /*#__PURE__*/Schema.optional(InferenceConfiguration),
493
+ performanceConfig: /*#__PURE__*/Schema.optional(PerformanceConfiguration),
494
+ promptVariables: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
495
+ key: Schema.String,
496
+ value: /*#__PURE__*/Schema.Struct({
497
+ text: Schema.String
498
+ })
499
+ })),
500
+ requestMetadata: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
501
+ key: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(256), /*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9\s:_@$#=/+,-.]{1,256}$/)),
502
+ value: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(0), /*#__PURE__*/Schema.maxLength(256), /*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9\s:_@$#=/+,-.]{0,256}$/))
503
+ })),
504
+ additionalModelRequestFields: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
505
+ key: Schema.String,
506
+ value: Schema.Unknown
507
+ })),
508
+ additionalModelResponseFieldPaths: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Schema.String.pipe(Schema.minLength(1), Schema.maxLength(256))).pipe(/*#__PURE__*/Schema.maxItems(10)))
509
+ }) {}
510
+ /**
511
+ * @since 1.0.0
512
+ * @category Schemas
513
+ */
514
+ export class ConverseResponse extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseResponse"))({
515
+ output: ConverseOutput,
516
+ metrics: ConverseMetrics,
517
+ usage: TokenUsage,
518
+ stopReason: /*#__PURE__*/Schema.Literal("content_filtered", "end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened"),
519
+ trace: /*#__PURE__*/Schema.optional(ConverseTrace),
520
+ performanceConfig: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
521
+ latency: /*#__PURE__*/Schema.Literal("standard", "optimized")
522
+ })),
523
+ additionalModelResponseFields: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
524
+ key: Schema.String,
525
+ value: Schema.Unknown
526
+ }))
527
+ }) {}
528
+ /**
529
+ * @since 1.0.0
530
+ * @category Schemas
531
+ */
532
+ export class ReasoningContentBlockDelta extends /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
533
+ redactedContent: Schema.Uint8ArrayFromBase64
534
+ }), /*#__PURE__*/Schema.Struct({
535
+ signature: Schema.String
536
+ }), /*#__PURE__*/Schema.Struct({
537
+ text: Schema.String
538
+ })) {}
539
+ /**
540
+ * @since 1.0.0
541
+ * @category Schemas
542
+ */
543
+ export class ToolUseBlockStart extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolUseBlockStart"))({
544
+ name: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64), /*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/)),
545
+ toolUseId: /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.minLength(1), /*#__PURE__*/Schema.maxLength(64), /*#__PURE__*/Schema.pattern(/^[a-zA-Z0-9_-]+$/))
546
+ }) {}
547
+ /**
548
+ * @since 1.0.0
549
+ * @category Schemas
550
+ */
551
+ export class ContentBlockStart extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockStart"))({
552
+ toolUse: ToolUseBlockStart
553
+ }) {}
554
+ /**
555
+ * @since 1.0.0
556
+ * @category Schemas
557
+ */
558
+ export class ContentBlockStartEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockStartEvent"))({
559
+ contentBlockIndex: /*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0)),
560
+ start: ContentBlockStart
561
+ }) {}
562
+ /**
563
+ * @since 1.0.0
564
+ * @category Schemas
565
+ */
566
+ export class ContentBlockStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockStopEvent"))({
567
+ contentBlockIndex: /*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0))
568
+ }) {}
569
+ /**
570
+ * @since 1.0.0
571
+ * @category Schemas
572
+ */
573
+ export class ToolUseBlockDelta extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolUseBlockDelta"))({
574
+ input: Schema.String
575
+ }) {}
576
+ /**
577
+ * @since 1.0.0
578
+ * @category Schemas
579
+ */
580
+ export class ContentBlockDelta extends /*#__PURE__*/Schema.Union(/*#__PURE__*/Schema.Struct({
581
+ reasoningContent: ReasoningContentBlockDelta
582
+ }), /*#__PURE__*/Schema.Struct({
583
+ text: Schema.String
584
+ }), /*#__PURE__*/Schema.Struct({
585
+ toolUse: ToolUseBlockDelta
586
+ })) {}
587
+ /**
588
+ * @since 1.0.0
589
+ * @category Schemas
590
+ */
591
+ export class ContentBlockDeltaEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockDeltaEvent"))({
592
+ contentBlockIndex: /*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0)),
593
+ delta: ContentBlockDelta
594
+ }) {}
595
+ /**
596
+ * @since 1.0.0
597
+ * @category Schemas
598
+ */
599
+ export class MessageStartEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("MessageStartEvent"))({
600
+ role: /*#__PURE__*/Schema.Literal("user", "assistant")
601
+ }) {}
602
+ /**
603
+ * @since 1.0.0
604
+ * @category Schemas
605
+ */
606
+ export const StopReason = /*#__PURE__*/Schema.Literal("end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered");
607
+ /**
608
+ * @since 1.0.0
609
+ * @category Schemas
610
+ */
611
+ export class MessageStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("MessageStopEvent"))({
612
+ stopReason: StopReason,
613
+ additionalModelResponseFields: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
614
+ key: Schema.String,
615
+ value: Schema.Unknown
616
+ }))
617
+ }) {}
618
+ /**
619
+ * @since 1.0.0
620
+ * @category Schemas
621
+ */
622
+ export class ConverseStreamMetrics extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamMetrics"))({
623
+ latencyMs: Schema.DurationFromMillis
624
+ }) {}
625
+ /**
626
+ * @since 1.0.0
627
+ * @category Schemas
628
+ */
629
+ export class ConverseStreamTrace extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamTrace"))({
630
+ guardrail: /*#__PURE__*/Schema.optional(GuardrailTraceAssessment),
631
+ promptRouter: /*#__PURE__*/Schema.optional(PromptRouterTrace)
632
+ }) {}
633
+ /**
634
+ * @since 1.0.0
635
+ * @category Schemas
636
+ */
637
+ export class ConverseStreamMetadataEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamMetadataEvent"))({
638
+ metrics: ConverseStreamMetrics,
639
+ usage: TokenUsage,
640
+ performanceConfig: /*#__PURE__*/Schema.optional(PerformanceConfiguration),
641
+ trace: /*#__PURE__*/Schema.optional(ConverseStreamTrace)
642
+ }) {}
643
+ /**
644
+ * @since 1.0.0
645
+ * @category Schemas
646
+ */
647
+ export class ConverseStreamResponse extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamResponse"))({
648
+ contentBlockStart: /*#__PURE__*/Schema.optional(ContentBlockStartEvent),
649
+ contentBlockStop: /*#__PURE__*/Schema.optional(ContentBlockStopEvent),
650
+ contentBlockDelta: /*#__PURE__*/Schema.optional(ContentBlockDeltaEvent),
651
+ messageStart: /*#__PURE__*/Schema.optional(MessageStartEvent),
652
+ messageStop: /*#__PURE__*/Schema.optional(MessageStopEvent),
653
+ metadata: /*#__PURE__*/Schema.optional(ConverseStreamMetadataEvent),
654
+ internalServerException: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
655
+ key: Schema.String,
656
+ value: Schema.Unknown
657
+ })),
658
+ modelStreamErrorException: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
659
+ key: Schema.String,
660
+ value: Schema.Unknown
661
+ })),
662
+ serviceUnavailableException: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
663
+ key: Schema.String,
664
+ value: Schema.Unknown
665
+ })),
666
+ throttlingException: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
667
+ key: Schema.String,
668
+ value: Schema.Unknown
669
+ })),
670
+ validationException: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record({
671
+ key: Schema.String,
672
+ value: Schema.Unknown
673
+ }))
674
+ }) {}
675
+ //# sourceMappingURL=AmazonBedrockSchema.js.map