@wmaurer/effect-ai-amazon-bedrock 0.1.0 → 0.2.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.
- package/CHANGELOG.md +14 -0
- package/README.md +77 -9
- package/dist/AmazonBedrockClient.d.ts +135 -23
- package/dist/AmazonBedrockClient.d.ts.map +1 -1
- package/dist/AmazonBedrockClient.js +36 -92
- package/dist/AmazonBedrockClient.js.map +1 -1
- package/dist/AmazonBedrockConfig.d.ts +6 -6
- package/dist/AmazonBedrockConfig.js +4 -4
- package/dist/AmazonBedrockEventStream.d.ts +2 -2
- package/dist/AmazonBedrockEventStream.js +3 -3
- package/dist/AmazonBedrockLanguageModel.d.ts +22 -22
- package/dist/AmazonBedrockLanguageModel.js +7 -7
- package/dist/AmazonBedrockSchema.d.ts +52 -52
- package/dist/AmazonBedrockSchema.js +49 -49
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/internal/credentials.d.ts +79 -0
- package/dist/internal/credentials.d.ts.map +1 -0
- package/dist/internal/credentials.js +241 -0
- package/dist/internal/credentials.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +6 -0
- package/dist/internal/errors.js.map +1 -1
- package/package.json +1 -1
- package/src/AmazonBedrockClient.ts +184 -95
- package/src/AmazonBedrockConfig.ts +6 -6
- package/src/AmazonBedrockEventStream.ts +3 -3
- package/src/AmazonBedrockLanguageModel.ts +23 -23
- package/src/AmazonBedrockSchema.ts +52 -52
- package/src/index.ts +6 -6
- package/src/internal/credentials.ts +319 -0
- package/src/internal/errors.ts +5 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* so decoding never fails on them.
|
|
12
12
|
*
|
|
13
13
|
* @stability unstable
|
|
14
|
-
* @since
|
|
14
|
+
* @since 0.1.0
|
|
15
15
|
*/
|
|
16
16
|
import * as Schema from "effect/Schema";
|
|
17
17
|
const prefix = "@wmaurer/effect-ai-amazon-bedrock";
|
|
@@ -21,7 +21,7 @@ const makeIdentifier = name => `${prefix}/${name}`;
|
|
|
21
21
|
*
|
|
22
22
|
* @stability unstable
|
|
23
23
|
* @category schemas
|
|
24
|
-
* @since
|
|
24
|
+
* @since 0.1.0
|
|
25
25
|
*/
|
|
26
26
|
export const IntZeroOrGreater = /*#__PURE__*/Schema.Int.check(/*#__PURE__*/Schema.isGreaterThanOrEqualTo(0));
|
|
27
27
|
/**
|
|
@@ -29,7 +29,7 @@ export const IntZeroOrGreater = /*#__PURE__*/Schema.Int.check(/*#__PURE__*/Schem
|
|
|
29
29
|
*
|
|
30
30
|
* @stability unstable
|
|
31
31
|
* @category schemas
|
|
32
|
-
* @since
|
|
32
|
+
* @since 0.1.0
|
|
33
33
|
*/
|
|
34
34
|
export const StopReason = /*#__PURE__*/Schema.Literals(["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]);
|
|
35
35
|
/**
|
|
@@ -37,7 +37,7 @@ export const StopReason = /*#__PURE__*/Schema.Literals(["end_turn", "tool_use",
|
|
|
37
37
|
*
|
|
38
38
|
* @stability unstable
|
|
39
39
|
* @category schemas
|
|
40
|
-
* @since
|
|
40
|
+
* @since 0.1.0
|
|
41
41
|
*/
|
|
42
42
|
export class TokenUsage extends /*#__PURE__*/Schema.Class(makeIdentifier("TokenUsage"))({
|
|
43
43
|
inputTokens: IntZeroOrGreater,
|
|
@@ -54,7 +54,7 @@ export class TokenUsage extends /*#__PURE__*/Schema.Class(makeIdentifier("TokenU
|
|
|
54
54
|
*
|
|
55
55
|
* @stability unstable
|
|
56
56
|
* @category schemas
|
|
57
|
-
* @since
|
|
57
|
+
* @since 0.1.0
|
|
58
58
|
*/
|
|
59
59
|
export class ToolUseBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolUseBlock"))({
|
|
60
60
|
toolUseId: Schema.String,
|
|
@@ -67,7 +67,7 @@ export class ToolUseBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("Tool
|
|
|
67
67
|
*
|
|
68
68
|
* @stability unstable
|
|
69
69
|
* @category schemas
|
|
70
|
-
* @since
|
|
70
|
+
* @since 0.1.0
|
|
71
71
|
*/
|
|
72
72
|
export class ToolResultBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolResultBlock"))({
|
|
73
73
|
toolUseId: Schema.String,
|
|
@@ -86,7 +86,7 @@ export class ToolResultBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("T
|
|
|
86
86
|
*
|
|
87
87
|
* @stability unstable
|
|
88
88
|
* @category schemas
|
|
89
|
-
* @since
|
|
89
|
+
* @since 0.1.0
|
|
90
90
|
*/
|
|
91
91
|
export class ReasoningTextBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ReasoningTextBlock"))({
|
|
92
92
|
text: Schema.String,
|
|
@@ -104,7 +104,7 @@ export class ReasoningTextBlock extends /*#__PURE__*/Schema.Class(makeIdentifier
|
|
|
104
104
|
*
|
|
105
105
|
* @stability unstable
|
|
106
106
|
* @category schemas
|
|
107
|
-
* @since
|
|
107
|
+
* @since 0.1.0
|
|
108
108
|
*/
|
|
109
109
|
export const ReasoningContentBlock = /*#__PURE__*/Schema.Struct({
|
|
110
110
|
reasoningText: /*#__PURE__*/Schema.optional(ReasoningTextBlock),
|
|
@@ -127,7 +127,7 @@ export const ReasoningContentBlock = /*#__PURE__*/Schema.Struct({
|
|
|
127
127
|
*
|
|
128
128
|
* @stability unstable
|
|
129
129
|
* @category schemas
|
|
130
|
-
* @since
|
|
130
|
+
* @since 0.1.0
|
|
131
131
|
*/
|
|
132
132
|
export class CachePointBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("CachePointBlock"))({
|
|
133
133
|
type: /*#__PURE__*/Schema.Literal("default"),
|
|
@@ -138,7 +138,7 @@ export class CachePointBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("C
|
|
|
138
138
|
*
|
|
139
139
|
* @stability unstable
|
|
140
140
|
* @category schemas
|
|
141
|
-
* @since
|
|
141
|
+
* @since 0.1.0
|
|
142
142
|
*/
|
|
143
143
|
export class S3Location extends /*#__PURE__*/Schema.Class(makeIdentifier("S3Location"))({
|
|
144
144
|
uri: Schema.String,
|
|
@@ -155,7 +155,7 @@ export class S3Location extends /*#__PURE__*/Schema.Class(makeIdentifier("S3Loca
|
|
|
155
155
|
*
|
|
156
156
|
* @stability unstable
|
|
157
157
|
* @category schemas
|
|
158
|
-
* @since
|
|
158
|
+
* @since 0.1.0
|
|
159
159
|
*/
|
|
160
160
|
export const MediaSource = /*#__PURE__*/Schema.Struct({
|
|
161
161
|
bytes: /*#__PURE__*/Schema.optional(Schema.String),
|
|
@@ -174,7 +174,7 @@ export const MediaSource = /*#__PURE__*/Schema.Struct({
|
|
|
174
174
|
*
|
|
175
175
|
* @stability unstable
|
|
176
176
|
* @category schemas
|
|
177
|
-
* @since
|
|
177
|
+
* @since 0.1.0
|
|
178
178
|
*/
|
|
179
179
|
export const DocumentSource = /*#__PURE__*/Schema.Struct({
|
|
180
180
|
...MediaSource.fields,
|
|
@@ -185,7 +185,7 @@ export const DocumentSource = /*#__PURE__*/Schema.Struct({
|
|
|
185
185
|
*
|
|
186
186
|
* @stability unstable
|
|
187
187
|
* @category schemas
|
|
188
|
-
* @since
|
|
188
|
+
* @since 0.1.0
|
|
189
189
|
*/
|
|
190
190
|
export class ImageBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ImageBlock"))({
|
|
191
191
|
format: /*#__PURE__*/Schema.Literals(["png", "jpeg", "gif", "webp"]),
|
|
@@ -201,7 +201,7 @@ export class ImageBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("ImageB
|
|
|
201
201
|
*
|
|
202
202
|
* @stability unstable
|
|
203
203
|
* @category schemas
|
|
204
|
-
* @since
|
|
204
|
+
* @since 0.1.0
|
|
205
205
|
*/
|
|
206
206
|
export class CitationsConfig extends /*#__PURE__*/Schema.Class(makeIdentifier("CitationsConfig"))({
|
|
207
207
|
enabled: Schema.Boolean
|
|
@@ -221,7 +221,7 @@ export class CitationsConfig extends /*#__PURE__*/Schema.Class(makeIdentifier("C
|
|
|
221
221
|
*
|
|
222
222
|
* @stability unstable
|
|
223
223
|
* @category schemas
|
|
224
|
-
* @since
|
|
224
|
+
* @since 0.1.0
|
|
225
225
|
*/
|
|
226
226
|
export class DocumentBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("DocumentBlock"))({
|
|
227
227
|
format: /*#__PURE__*/Schema.Literals(["pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md"]),
|
|
@@ -242,7 +242,7 @@ export class DocumentBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("Doc
|
|
|
242
242
|
*
|
|
243
243
|
* @stability unstable
|
|
244
244
|
* @category schemas
|
|
245
|
-
* @since
|
|
245
|
+
* @since 0.1.0
|
|
246
246
|
*/
|
|
247
247
|
export class DocumentLocation extends /*#__PURE__*/Schema.Class(makeIdentifier("DocumentLocation"))({
|
|
248
248
|
documentIndex: /*#__PURE__*/Schema.optional(Schema.Number),
|
|
@@ -260,7 +260,7 @@ export class DocumentLocation extends /*#__PURE__*/Schema.Class(makeIdentifier("
|
|
|
260
260
|
*
|
|
261
261
|
* @stability unstable
|
|
262
262
|
* @category schemas
|
|
263
|
-
* @since
|
|
263
|
+
* @since 0.1.0
|
|
264
264
|
*/
|
|
265
265
|
export const CitationLocation = /*#__PURE__*/Schema.Struct({
|
|
266
266
|
documentChar: /*#__PURE__*/Schema.optional(DocumentLocation),
|
|
@@ -278,7 +278,7 @@ export const CitationLocation = /*#__PURE__*/Schema.Struct({
|
|
|
278
278
|
*
|
|
279
279
|
* @stability unstable
|
|
280
280
|
* @category schemas
|
|
281
|
-
* @since
|
|
281
|
+
* @since 0.1.0
|
|
282
282
|
*/
|
|
283
283
|
export const CitationTextContent = /*#__PURE__*/Schema.Struct({
|
|
284
284
|
text: /*#__PURE__*/Schema.optional(Schema.String)
|
|
@@ -288,7 +288,7 @@ export const CitationTextContent = /*#__PURE__*/Schema.Struct({
|
|
|
288
288
|
*
|
|
289
289
|
* @stability unstable
|
|
290
290
|
* @category schemas
|
|
291
|
-
* @since
|
|
291
|
+
* @since 0.1.0
|
|
292
292
|
*/
|
|
293
293
|
export class Citation extends /*#__PURE__*/Schema.Class(makeIdentifier("Citation"))({
|
|
294
294
|
title: /*#__PURE__*/Schema.optional(Schema.String),
|
|
@@ -306,7 +306,7 @@ export class Citation extends /*#__PURE__*/Schema.Class(makeIdentifier("Citation
|
|
|
306
306
|
*
|
|
307
307
|
* @stability unstable
|
|
308
308
|
* @category schemas
|
|
309
|
-
* @since
|
|
309
|
+
* @since 0.1.0
|
|
310
310
|
*/
|
|
311
311
|
export class CitationsContentBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("CitationsContentBlock"))({
|
|
312
312
|
content: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(CitationTextContent)),
|
|
@@ -325,7 +325,7 @@ export class CitationsContentBlock extends /*#__PURE__*/Schema.Class(makeIdentif
|
|
|
325
325
|
*
|
|
326
326
|
* @stability unstable
|
|
327
327
|
* @category schemas
|
|
328
|
-
* @since
|
|
328
|
+
* @since 0.1.0
|
|
329
329
|
*/
|
|
330
330
|
export const ContentBlock = /*#__PURE__*/Schema.Struct({
|
|
331
331
|
type: /*#__PURE__*/Schema.tagDefaultOmit("text"),
|
|
@@ -343,7 +343,7 @@ export const ContentBlock = /*#__PURE__*/Schema.Struct({
|
|
|
343
343
|
*
|
|
344
344
|
* @stability unstable
|
|
345
345
|
* @category schemas
|
|
346
|
-
* @since
|
|
346
|
+
* @since 0.1.0
|
|
347
347
|
*/
|
|
348
348
|
export class Message extends /*#__PURE__*/Schema.Class(makeIdentifier("Message"))({
|
|
349
349
|
role: /*#__PURE__*/Schema.Literals(["user", "assistant"]),
|
|
@@ -359,7 +359,7 @@ export class Message extends /*#__PURE__*/Schema.Class(makeIdentifier("Message")
|
|
|
359
359
|
*
|
|
360
360
|
* @stability unstable
|
|
361
361
|
* @category schemas
|
|
362
|
-
* @since
|
|
362
|
+
* @since 0.1.0
|
|
363
363
|
*/
|
|
364
364
|
export const SystemContentBlock = /*#__PURE__*/Schema.Struct({
|
|
365
365
|
text: /*#__PURE__*/Schema.optional(Schema.String),
|
|
@@ -370,7 +370,7 @@ export const SystemContentBlock = /*#__PURE__*/Schema.Struct({
|
|
|
370
370
|
*
|
|
371
371
|
* @stability unstable
|
|
372
372
|
* @category schemas
|
|
373
|
-
* @since
|
|
373
|
+
* @since 0.1.0
|
|
374
374
|
*/
|
|
375
375
|
export class InferenceConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("InferenceConfiguration"))({
|
|
376
376
|
maxTokens: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Int.check(/*#__PURE__*/Schema.isGreaterThanOrEqualTo(1))),
|
|
@@ -383,7 +383,7 @@ export class InferenceConfiguration extends /*#__PURE__*/Schema.Class(makeIdenti
|
|
|
383
383
|
*
|
|
384
384
|
* @stability unstable
|
|
385
385
|
* @category schemas
|
|
386
|
-
* @since
|
|
386
|
+
* @since 0.1.0
|
|
387
387
|
*/
|
|
388
388
|
export class ToolSpecification extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolSpecification"))({
|
|
389
389
|
name: Schema.String,
|
|
@@ -407,7 +407,7 @@ export class ToolSpecification extends /*#__PURE__*/Schema.Class(makeIdentifier(
|
|
|
407
407
|
*
|
|
408
408
|
* @stability unstable
|
|
409
409
|
* @category schemas
|
|
410
|
-
* @since
|
|
410
|
+
* @since 0.1.0
|
|
411
411
|
*/
|
|
412
412
|
export class Tool extends /*#__PURE__*/Schema.Class(makeIdentifier("Tool"))({
|
|
413
413
|
toolSpec: /*#__PURE__*/Schema.optional(ToolSpecification),
|
|
@@ -419,7 +419,7 @@ export class Tool extends /*#__PURE__*/Schema.Class(makeIdentifier("Tool"))({
|
|
|
419
419
|
*
|
|
420
420
|
* @stability unstable
|
|
421
421
|
* @category schemas
|
|
422
|
-
* @since
|
|
422
|
+
* @since 0.1.0
|
|
423
423
|
*/
|
|
424
424
|
export const ToolChoice = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
|
|
425
425
|
auto: /*#__PURE__*/Schema.Struct({})
|
|
@@ -435,7 +435,7 @@ export const ToolChoice = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct(
|
|
|
435
435
|
*
|
|
436
436
|
* @stability unstable
|
|
437
437
|
* @category schemas
|
|
438
|
-
* @since
|
|
438
|
+
* @since 0.1.0
|
|
439
439
|
*/
|
|
440
440
|
export class ToolConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("ToolConfiguration"))({
|
|
441
441
|
tools: /*#__PURE__*/Schema.Array(Tool),
|
|
@@ -451,7 +451,7 @@ export class ToolConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier(
|
|
|
451
451
|
*
|
|
452
452
|
* @stability unstable
|
|
453
453
|
* @category schemas
|
|
454
|
-
* @since
|
|
454
|
+
* @since 0.1.0
|
|
455
455
|
*/
|
|
456
456
|
export const JsonSchemaDefinition = /*#__PURE__*/Schema.Struct({
|
|
457
457
|
schema: Schema.String,
|
|
@@ -464,7 +464,7 @@ export const JsonSchemaDefinition = /*#__PURE__*/Schema.Struct({
|
|
|
464
464
|
*
|
|
465
465
|
* @stability unstable
|
|
466
466
|
* @category schemas
|
|
467
|
-
* @since
|
|
467
|
+
* @since 0.1.0
|
|
468
468
|
*/
|
|
469
469
|
export const OutputFormatStructure = /*#__PURE__*/Schema.Struct({
|
|
470
470
|
jsonSchema: JsonSchemaDefinition
|
|
@@ -474,7 +474,7 @@ export const OutputFormatStructure = /*#__PURE__*/Schema.Struct({
|
|
|
474
474
|
*
|
|
475
475
|
* @stability unstable
|
|
476
476
|
* @category schemas
|
|
477
|
-
* @since
|
|
477
|
+
* @since 0.1.0
|
|
478
478
|
*/
|
|
479
479
|
export const OutputFormat = /*#__PURE__*/Schema.Struct({
|
|
480
480
|
type: /*#__PURE__*/Schema.Literal("json_schema"),
|
|
@@ -487,7 +487,7 @@ export const OutputFormat = /*#__PURE__*/Schema.Struct({
|
|
|
487
487
|
*
|
|
488
488
|
* @stability unstable
|
|
489
489
|
* @category schemas
|
|
490
|
-
* @since
|
|
490
|
+
* @since 0.1.0
|
|
491
491
|
*/
|
|
492
492
|
export const OutputConfig = /*#__PURE__*/Schema.Struct({
|
|
493
493
|
textFormat: /*#__PURE__*/Schema.optionalKey(OutputFormat),
|
|
@@ -509,7 +509,7 @@ export const OutputConfig = /*#__PURE__*/Schema.Struct({
|
|
|
509
509
|
*
|
|
510
510
|
* @stability unstable
|
|
511
511
|
* @category schemas
|
|
512
|
-
* @since
|
|
512
|
+
* @since 0.1.0
|
|
513
513
|
*/
|
|
514
514
|
export class ConverseRequest extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseRequest"))({
|
|
515
515
|
modelId: Schema.String,
|
|
@@ -528,7 +528,7 @@ export class ConverseRequest extends /*#__PURE__*/Schema.Class(makeIdentifier("C
|
|
|
528
528
|
*
|
|
529
529
|
* @stability unstable
|
|
530
530
|
* @category schemas
|
|
531
|
-
* @since
|
|
531
|
+
* @since 0.1.0
|
|
532
532
|
*/
|
|
533
533
|
export class ConverseOutput extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseOutput"))({
|
|
534
534
|
message: Message
|
|
@@ -538,7 +538,7 @@ export class ConverseOutput extends /*#__PURE__*/Schema.Class(makeIdentifier("Co
|
|
|
538
538
|
*
|
|
539
539
|
* @stability unstable
|
|
540
540
|
* @category schemas
|
|
541
|
-
* @since
|
|
541
|
+
* @since 0.1.0
|
|
542
542
|
*/
|
|
543
543
|
export class ConverseMetrics extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseMetrics"))({
|
|
544
544
|
latencyMs: Schema.Number
|
|
@@ -548,7 +548,7 @@ export class ConverseMetrics extends /*#__PURE__*/Schema.Class(makeIdentifier("C
|
|
|
548
548
|
*
|
|
549
549
|
* @stability unstable
|
|
550
550
|
* @category schemas
|
|
551
|
-
* @since
|
|
551
|
+
* @since 0.1.0
|
|
552
552
|
*/
|
|
553
553
|
export class ConverseResponse extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseResponse"))({
|
|
554
554
|
output: ConverseOutput,
|
|
@@ -564,7 +564,7 @@ export class ConverseResponse extends /*#__PURE__*/Schema.Class(makeIdentifier("
|
|
|
564
564
|
*
|
|
565
565
|
* @stability unstable
|
|
566
566
|
* @category schemas
|
|
567
|
-
* @since
|
|
567
|
+
* @since 0.1.0
|
|
568
568
|
*/
|
|
569
569
|
export class MessageStartEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("MessageStartEvent"))({
|
|
570
570
|
role: /*#__PURE__*/Schema.Literals(["user", "assistant"])
|
|
@@ -576,7 +576,7 @@ export class MessageStartEvent extends /*#__PURE__*/Schema.Class(makeIdentifier(
|
|
|
576
576
|
*
|
|
577
577
|
* @stability unstable
|
|
578
578
|
* @category schemas
|
|
579
|
-
* @since
|
|
579
|
+
* @since 0.1.0
|
|
580
580
|
*/
|
|
581
581
|
export const ToolUseBlockDelta = /*#__PURE__*/Schema.Struct({
|
|
582
582
|
input: Schema.String
|
|
@@ -592,7 +592,7 @@ export const ToolUseBlockDelta = /*#__PURE__*/Schema.Struct({
|
|
|
592
592
|
*
|
|
593
593
|
* @stability unstable
|
|
594
594
|
* @category schemas
|
|
595
|
-
* @since
|
|
595
|
+
* @since 0.1.0
|
|
596
596
|
*/
|
|
597
597
|
export const ReasoningContentBlockDelta = /*#__PURE__*/Schema.Struct({
|
|
598
598
|
text: /*#__PURE__*/Schema.optional(Schema.String),
|
|
@@ -609,7 +609,7 @@ export const ReasoningContentBlockDelta = /*#__PURE__*/Schema.Struct({
|
|
|
609
609
|
*
|
|
610
610
|
* @stability unstable
|
|
611
611
|
* @category schemas
|
|
612
|
-
* @since
|
|
612
|
+
* @since 0.1.0
|
|
613
613
|
*/
|
|
614
614
|
export class CitationsDelta extends /*#__PURE__*/Schema.Class(makeIdentifier("CitationsDelta"))({
|
|
615
615
|
title: /*#__PURE__*/Schema.optional(Schema.String),
|
|
@@ -630,7 +630,7 @@ export class CitationsDelta extends /*#__PURE__*/Schema.Class(makeIdentifier("Ci
|
|
|
630
630
|
*
|
|
631
631
|
* @stability unstable
|
|
632
632
|
* @category schemas
|
|
633
|
-
* @since
|
|
633
|
+
* @since 0.1.0
|
|
634
634
|
*/
|
|
635
635
|
export const ContentBlockDelta = /*#__PURE__*/Schema.Struct({
|
|
636
636
|
text: /*#__PURE__*/Schema.optional(Schema.String),
|
|
@@ -643,7 +643,7 @@ export const ContentBlockDelta = /*#__PURE__*/Schema.Struct({
|
|
|
643
643
|
*
|
|
644
644
|
* @stability unstable
|
|
645
645
|
* @category schemas
|
|
646
|
-
* @since
|
|
646
|
+
* @since 0.1.0
|
|
647
647
|
*/
|
|
648
648
|
export class ContentBlockDeltaEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockDeltaEvent"))({
|
|
649
649
|
contentBlockIndex: IntZeroOrGreater,
|
|
@@ -654,7 +654,7 @@ export class ContentBlockDeltaEvent extends /*#__PURE__*/Schema.Class(makeIdenti
|
|
|
654
654
|
*
|
|
655
655
|
* @stability unstable
|
|
656
656
|
* @category schemas
|
|
657
|
-
* @since
|
|
657
|
+
* @since 0.1.0
|
|
658
658
|
*/
|
|
659
659
|
export class ContentBlockStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockStopEvent"))({
|
|
660
660
|
contentBlockIndex: IntZeroOrGreater
|
|
@@ -665,7 +665,7 @@ export class ContentBlockStopEvent extends /*#__PURE__*/Schema.Class(makeIdentif
|
|
|
665
665
|
*
|
|
666
666
|
* @stability unstable
|
|
667
667
|
* @category schemas
|
|
668
|
-
* @since
|
|
668
|
+
* @since 0.1.0
|
|
669
669
|
*/
|
|
670
670
|
export const ToolUseBlockStart = /*#__PURE__*/Schema.Struct({
|
|
671
671
|
toolUseId: Schema.String,
|
|
@@ -682,7 +682,7 @@ export const ToolUseBlockStart = /*#__PURE__*/Schema.Struct({
|
|
|
682
682
|
*
|
|
683
683
|
* @stability unstable
|
|
684
684
|
* @category schemas
|
|
685
|
-
* @since
|
|
685
|
+
* @since 0.1.0
|
|
686
686
|
*/
|
|
687
687
|
export const ContentBlockStart = /*#__PURE__*/Schema.Struct({
|
|
688
688
|
toolUse: /*#__PURE__*/Schema.optional(ToolUseBlockStart)
|
|
@@ -695,7 +695,7 @@ export const ContentBlockStart = /*#__PURE__*/Schema.Struct({
|
|
|
695
695
|
*
|
|
696
696
|
* @stability unstable
|
|
697
697
|
* @category schemas
|
|
698
|
-
* @since
|
|
698
|
+
* @since 0.1.0
|
|
699
699
|
*/
|
|
700
700
|
export class ContentBlockStartEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ContentBlockStartEvent"))({
|
|
701
701
|
contentBlockIndex: IntZeroOrGreater,
|
|
@@ -706,7 +706,7 @@ export class ContentBlockStartEvent extends /*#__PURE__*/Schema.Class(makeIdenti
|
|
|
706
706
|
*
|
|
707
707
|
* @stability unstable
|
|
708
708
|
* @category schemas
|
|
709
|
-
* @since
|
|
709
|
+
* @since 0.1.0
|
|
710
710
|
*/
|
|
711
711
|
export class MessageStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("MessageStopEvent"))({
|
|
712
712
|
stopReason: StopReason
|
|
@@ -716,7 +716,7 @@ export class MessageStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("
|
|
|
716
716
|
*
|
|
717
717
|
* @stability unstable
|
|
718
718
|
* @category schemas
|
|
719
|
-
* @since
|
|
719
|
+
* @since 0.1.0
|
|
720
720
|
*/
|
|
721
721
|
export class ConverseStreamMetadataEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamMetadataEvent"))({
|
|
722
722
|
usage: TokenUsage,
|
|
@@ -736,7 +736,7 @@ const ExceptionBody = /*#__PURE__*/Schema.Struct({
|
|
|
736
736
|
*
|
|
737
737
|
* @stability unstable
|
|
738
738
|
* @category schemas
|
|
739
|
-
* @since
|
|
739
|
+
* @since 0.1.0
|
|
740
740
|
*/
|
|
741
741
|
export const ConverseResponseStreamEvent = /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Struct({
|
|
742
742
|
type: /*#__PURE__*/Schema.tagDefaultOmit("messageStart"),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @stability unstable
|
|
3
|
-
* @since
|
|
3
|
+
* @since 0.1.0
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @stability unstable
|
|
7
|
-
* @since
|
|
7
|
+
* @since 0.1.0
|
|
8
8
|
*/
|
|
9
9
|
export * as AmazonBedrockClient from "./AmazonBedrockClient.ts";
|
|
10
10
|
/**
|
|
11
11
|
* @stability unstable
|
|
12
|
-
* @since
|
|
12
|
+
* @since 0.1.0
|
|
13
13
|
*/
|
|
14
14
|
export * as AmazonBedrockConfig from "./AmazonBedrockConfig.ts";
|
|
15
15
|
/**
|
|
16
16
|
* @stability unstable
|
|
17
|
-
* @since
|
|
17
|
+
* @since 0.1.0
|
|
18
18
|
*/
|
|
19
19
|
export * as AmazonBedrockEventStream from "./AmazonBedrockEventStream.ts";
|
|
20
20
|
/**
|
|
21
21
|
* @stability unstable
|
|
22
|
-
* @since
|
|
22
|
+
* @since 0.1.0
|
|
23
23
|
*/
|
|
24
24
|
export * as AmazonBedrockLanguageModel from "./AmazonBedrockLanguageModel.ts";
|
|
25
25
|
/**
|
|
26
26
|
* @stability unstable
|
|
27
|
-
* @since
|
|
27
|
+
* @since 0.1.0
|
|
28
28
|
*/
|
|
29
29
|
export * as AmazonBedrockSchema from "./AmazonBedrockSchema.ts";
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @stability unstable
|
|
3
|
-
* @since
|
|
3
|
+
* @since 0.1.0
|
|
4
4
|
*/
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
/**
|
|
7
7
|
* @stability unstable
|
|
8
|
-
* @since
|
|
8
|
+
* @since 0.1.0
|
|
9
9
|
*/
|
|
10
10
|
export * as AmazonBedrockClient from "./AmazonBedrockClient.js";
|
|
11
11
|
/**
|
|
12
12
|
* @stability unstable
|
|
13
|
-
* @since
|
|
13
|
+
* @since 0.1.0
|
|
14
14
|
*/
|
|
15
15
|
export * as AmazonBedrockConfig from "./AmazonBedrockConfig.js";
|
|
16
16
|
/**
|
|
17
17
|
* @stability unstable
|
|
18
|
-
* @since
|
|
18
|
+
* @since 0.1.0
|
|
19
19
|
*/
|
|
20
20
|
export * as AmazonBedrockEventStream from "./AmazonBedrockEventStream.js";
|
|
21
21
|
/**
|
|
22
22
|
* @stability unstable
|
|
23
|
-
* @since
|
|
23
|
+
* @since 0.1.0
|
|
24
24
|
*/
|
|
25
25
|
export * as AmazonBedrockLanguageModel from "./AmazonBedrockLanguageModel.js";
|
|
26
26
|
/**
|
|
27
27
|
* @stability unstable
|
|
28
|
-
* @since
|
|
28
|
+
* @since 0.1.0
|
|
29
29
|
*/
|
|
30
30
|
export * as AmazonBedrockSchema from "./AmazonBedrockSchema.js";
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as AiError from "effect/ai/AiError";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
5
|
+
import * as Redacted from "effect/Redacted";
|
|
6
|
+
import type { CredentialProvider } from "../AmazonBedrockClient.ts";
|
|
7
|
+
/**
|
|
8
|
+
* The authentication fields of the client's options. Every field is optional
|
|
9
|
+
* here, because a caller in untyped JavaScript can mix the three ways to
|
|
10
|
+
* authenticate that the public `Options` type keeps apart.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export interface AuthenticationOptions<R> {
|
|
15
|
+
readonly accessKeyId?: string | undefined;
|
|
16
|
+
readonly secretAccessKey?: Redacted.Redacted<string> | undefined;
|
|
17
|
+
readonly sessionToken?: Redacted.Redacted<string> | undefined;
|
|
18
|
+
readonly credentialProvider?: CredentialProvider<R> | undefined;
|
|
19
|
+
readonly apiKey?: Redacted.Redacted<string> | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What one request is authenticated with.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export type RequestCredentials = Bearer | SigV4;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export interface Bearer {
|
|
29
|
+
readonly _tag: "Bearer";
|
|
30
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
export interface SigV4 {
|
|
34
|
+
readonly _tag: "SigV4";
|
|
35
|
+
readonly accessKeyId: string;
|
|
36
|
+
readonly secretAccessKey: Redacted.Redacted<string>;
|
|
37
|
+
readonly sessionToken: Redacted.Redacted<string> | undefined;
|
|
38
|
+
readonly expiration: Date | undefined;
|
|
39
|
+
}
|
|
40
|
+
/** @internal */
|
|
41
|
+
export interface Authenticator {
|
|
42
|
+
/**
|
|
43
|
+
* The credentials for the next request. Only a credential provider can
|
|
44
|
+
* fail here.
|
|
45
|
+
*/
|
|
46
|
+
readonly resolve: Effect.Effect<RequestCredentials, AiError.AiError | AiError.AiErrorReason>;
|
|
47
|
+
/**
|
|
48
|
+
* Drops `rejected` from the cache if they are still the latest credentials
|
|
49
|
+
* from the provider, so that the next `resolve` asks the provider again with
|
|
50
|
+
* `forceRefresh`. Rejections of credentials that are no longer the latest do
|
|
51
|
+
* nothing, so many rejections of one set of credentials cause one refetch.
|
|
52
|
+
*/
|
|
53
|
+
readonly invalidate: (rejected: RequestCredentials) => Effect.Effect<void>;
|
|
54
|
+
}
|
|
55
|
+
/** @internal */
|
|
56
|
+
export declare const make: <R = never>(options: AuthenticationOptions<R>) => Effect.Effect<Authenticator, never, R>;
|
|
57
|
+
/**
|
|
58
|
+
* The credentials of the request in flight. The client resolves them before
|
|
59
|
+
* `HttpClient.execute` and provides them around it, so that a resolution
|
|
60
|
+
* failure is not an `HttpClientError` that a retry policy would retry, and so
|
|
61
|
+
* that every retry inside `execute` signs again with them.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare const CurrentRequestCredentials: Context.Reference<RequestCredentials | undefined>;
|
|
66
|
+
/**
|
|
67
|
+
* Signs the request with SigV4, or sets the bearer header of an API key, from
|
|
68
|
+
* {@link CurrentRequestCredentials}.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export declare const authenticateRequest: (region: string) => (request: HttpClientRequest.HttpClientRequest) => Effect.Effect<HttpClientRequest.HttpClientRequest, never, never>;
|
|
73
|
+
/**
|
|
74
|
+
* Invalidates `credentials` when `error` says Bedrock rejected them.
|
|
75
|
+
*
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export declare const invalidateIfRejected: (authenticator: Authenticator, credentials: RequestCredentials) => (error: AiError.AiError) => Effect.Effect<void>;
|
|
79
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/internal/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAE5C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,2BAA2B,CAAA;AAMhF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAC7D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CACxD;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,CAAA;AAE/C,gBAAgB;AAChB,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;CAC3C;AAED,gBAAgB;AAChB,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACnD,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAC5D,QAAQ,CAAC,UAAU,EAAE,IAAI,GAAG,SAAS,CAAA;CACtC;AAOD,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAC5F;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CAC3E;AAMD,gBAAgB;AAChB,eAAO,MAAM,IAAI,GAAI,CAAC,GAAG,KAAK,WAAW,qBAAqB,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC,CAcrG,CAAA;AAuIJ;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,mDAGrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WAAY,MAAM,uHA0B9C,CAAA;AAaJ;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,kBACf,aAAa,eAAe,kBAAkB,aAAa,OAAO,CAAC,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAG9F,CAAA"}
|