@wmaurer/effect-ai-amazon-bedrock 0.2.0 → 0.4.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.
@@ -22,14 +22,35 @@ import * as Schema from "effect/Schema";
22
22
  * @since 0.1.0
23
23
  */
24
24
  export declare const IntZeroOrGreater: Schema.Int;
25
+ /**
26
+ * The stop reasons that the Smithy model of the Converse API names.
27
+ *
28
+ * @stability unstable
29
+ * @category schemas
30
+ * @since 0.3.0
31
+ */
32
+ export declare const KnownStopReason: Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>;
33
+ /**
34
+ * The type of {@link KnownStopReason}.
35
+ *
36
+ * @stability unstable
37
+ * @category schemas
38
+ * @since 0.3.0
39
+ */
40
+ export type KnownStopReason = typeof KnownStopReason.Type;
25
41
  /**
26
42
  * The reason the model stopped generating a response.
27
43
  *
44
+ * **Details**
45
+ *
46
+ * Any string decodes, so a reason that Bedrock adds later, or that a model
47
+ * returns outside the Smithy model, does not fail the response.
48
+ *
28
49
  * @stability unstable
29
50
  * @category schemas
30
51
  * @since 0.1.0
31
52
  */
32
- export declare const StopReason: Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>;
53
+ export declare const StopReason: Schema.Union<readonly [Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>, Schema.StringForLiteralAutocomplete]>;
33
54
  /**
34
55
  * The type of {@link StopReason}.
35
56
  *
@@ -355,6 +376,77 @@ declare const CitationsContentBlock_base: Schema.Class<CitationsContentBlock, Sc
355
376
  */
356
377
  export declare class CitationsContentBlock extends CitationsContentBlock_base {
357
378
  }
379
+ /**
380
+ * The role a guarded text block plays in a contextual grounding check.
381
+ *
382
+ * **Details**
383
+ *
384
+ * `grounding_source` marks the documents an answer must be grounded in,
385
+ * `query` marks the question, and `guard_content` marks text the guardrail
386
+ * evaluates without a grounding role.
387
+ *
388
+ * @stability unstable
389
+ * @category schemas
390
+ * @since 0.4.0
391
+ */
392
+ export declare const GuardrailConverseContentQualifier: Schema.Literals<readonly ["grounding_source", "query", "guard_content"]>;
393
+ declare const GuardrailConverseTextBlock_base: Schema.Class<GuardrailConverseTextBlock, Schema.Struct<{
394
+ readonly text: Schema.String;
395
+ readonly qualifiers: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["grounding_source", "query", "guard_content"]>>>;
396
+ }>, {}>;
397
+ /**
398
+ * Text that the guardrail evaluates.
399
+ *
400
+ * **Details**
401
+ *
402
+ * `qualifiers` uses `optionalKey` for the same reason as
403
+ * `CachePointBlock.ttl`: the block is built from `Prompt` provider options,
404
+ * whose values must satisfy `Schema.Json`.
405
+ *
406
+ * @stability unstable
407
+ * @category schemas
408
+ * @since 0.4.0
409
+ */
410
+ export declare class GuardrailConverseTextBlock extends GuardrailConverseTextBlock_base {
411
+ }
412
+ declare const GuardrailConverseImageBlock_base: Schema.Class<GuardrailConverseImageBlock, Schema.Struct<{
413
+ readonly format: Schema.Literals<readonly ["png", "jpeg"]>;
414
+ readonly source: Schema.Struct<{
415
+ readonly bytes: Schema.String;
416
+ }>;
417
+ }>, {}>;
418
+ /**
419
+ * An image that the guardrail evaluates.
420
+ *
421
+ * **Details**
422
+ *
423
+ * The Smithy model allows only png and jpeg, and only `bytes` as the source.
424
+ * `bytes` is a Smithy blob, which the JSON protocol carries as a base64
425
+ * string.
426
+ *
427
+ * @stability unstable
428
+ * @category schemas
429
+ * @since 0.4.0
430
+ */
431
+ export declare class GuardrailConverseImageBlock extends GuardrailConverseImageBlock_base {
432
+ }
433
+ /**
434
+ * Content that the guardrail evaluates, in a message or in the system prompt.
435
+ *
436
+ * **Details**
437
+ *
438
+ * AWS models `GuardrailConverseContentBlock` as a UNION, so both members are
439
+ * optional here. Once a request holds one `guardContent` block, the guardrail
440
+ * evaluates only the guarded blocks. The model still reads every block.
441
+ *
442
+ * @stability unstable
443
+ * @category schemas
444
+ * @since 0.4.0
445
+ */
446
+ export declare const GuardrailConverseContentBlock: Schema.Struct<{
447
+ readonly text: Schema.optional<typeof GuardrailConverseTextBlock>;
448
+ readonly image: Schema.optional<typeof GuardrailConverseImageBlock>;
449
+ }>;
358
450
  /**
359
451
  * A text content block within a Converse message.
360
452
  *
@@ -383,6 +475,10 @@ export declare const ContentBlock: Schema.Struct<{
383
475
  readonly document: Schema.optional<typeof DocumentBlock>;
384
476
  readonly cachePoint: Schema.optional<typeof CachePointBlock>;
385
477
  readonly citationsContent: Schema.optional<typeof CitationsContentBlock>;
478
+ readonly guardContent: Schema.optional<Schema.Struct<{
479
+ readonly text: Schema.optional<typeof GuardrailConverseTextBlock>;
480
+ readonly image: Schema.optional<typeof GuardrailConverseImageBlock>;
481
+ }>>;
386
482
  }>;
387
483
  declare const Message_base: Schema.Class<Message, Schema.Struct<{
388
484
  readonly role: Schema.Literals<readonly ["user", "assistant"]>;
@@ -399,6 +495,10 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
399
495
  readonly document: Schema.optional<typeof DocumentBlock>;
400
496
  readonly cachePoint: Schema.optional<typeof CachePointBlock>;
401
497
  readonly citationsContent: Schema.optional<typeof CitationsContentBlock>;
498
+ readonly guardContent: Schema.optional<Schema.Struct<{
499
+ readonly text: Schema.optional<typeof GuardrailConverseTextBlock>;
500
+ readonly image: Schema.optional<typeof GuardrailConverseImageBlock>;
501
+ }>>;
402
502
  }>>;
403
503
  }>, {}>;
404
504
  /**
@@ -415,8 +515,9 @@ export declare class Message extends Message_base {
415
515
  *
416
516
  * **Details**
417
517
  *
418
- * AWS models `SystemContentBlock` as a UNION, so both members are optional; a
419
- * block carries either the system text or a cache point.
518
+ * AWS models `SystemContentBlock` as a UNION, so every member is optional; a
519
+ * block carries the system text, guarded system text, or a cache point. The
520
+ * guardrail evaluates the system prompt only where it is guarded.
420
521
  *
421
522
  * @stability unstable
422
523
  * @category schemas
@@ -425,6 +526,10 @@ export declare class Message extends Message_base {
425
526
  export declare const SystemContentBlock: Schema.Struct<{
426
527
  readonly text: Schema.optional<Schema.String>;
427
528
  readonly cachePoint: Schema.optional<typeof CachePointBlock>;
529
+ readonly guardContent: Schema.optional<Schema.Struct<{
530
+ readonly text: Schema.optional<typeof GuardrailConverseTextBlock>;
531
+ readonly image: Schema.optional<typeof GuardrailConverseImageBlock>;
532
+ }>>;
428
533
  }>;
429
534
  declare const InferenceConfiguration_base: Schema.Class<InferenceConfiguration, Schema.Struct<{
430
535
  readonly maxTokens: Schema.optional<Schema.Int>;
@@ -597,12 +702,81 @@ export declare const OutputConfig: Schema.Struct<{
597
702
  }>>;
598
703
  readonly effort: Schema.optionalKey<Schema.String>;
599
704
  }>;
705
+ /**
706
+ * Whether Bedrock returns the guardrail trace.
707
+ *
708
+ * **Details**
709
+ *
710
+ * Bedrock's default is `disabled`. The trace holds the text that a policy
711
+ * matched, unmasked. `enabled_full` is in the Smithy model, and AWS does not
712
+ * document it.
713
+ *
714
+ * @stability unstable
715
+ * @category schemas
716
+ * @since 0.4.0
717
+ */
718
+ export declare const GuardrailTrace: Schema.Literals<readonly ["enabled", "disabled", "enabled_full"]>;
719
+ /**
720
+ * How ConverseStream applies a guardrail to the streamed output.
721
+ *
722
+ * **Details**
723
+ *
724
+ * `sync`, Bedrock's default, holds back each chunk until the guardrail has
725
+ * evaluated it. `async` sends chunks at once, so text that the guardrail
726
+ * later blocks can reach the caller, and masking does not apply.
727
+ *
728
+ * @stability unstable
729
+ * @category schemas
730
+ * @since 0.4.0
731
+ */
732
+ export declare const GuardrailStreamProcessingMode: Schema.Literals<readonly ["sync", "async"]>;
733
+ declare const GuardrailConfiguration_base: Schema.Class<GuardrailConfiguration, Schema.Struct<{
734
+ readonly guardrailIdentifier: Schema.String;
735
+ readonly guardrailVersion: Schema.String;
736
+ readonly trace: Schema.optionalKey<Schema.Literals<readonly ["enabled", "disabled", "enabled_full"]>>;
737
+ readonly streamProcessingMode: Schema.optionalKey<Schema.Never>;
738
+ }>, {}>;
739
+ /**
740
+ * The guardrail of a Converse request.
741
+ *
742
+ * **Details**
743
+ *
744
+ * `guardrailIdentifier` is the guardrail's ID or ARN, and `guardrailVersion`
745
+ * is a version number or `DRAFT`. Converse has no `streamProcessingMode`, so
746
+ * the member is typed `never`: a ConverseStream request does not fit Converse
747
+ * until the mode is removed.
748
+ *
749
+ * @stability unstable
750
+ * @category schemas
751
+ * @since 0.4.0
752
+ */
753
+ export declare class GuardrailConfiguration extends GuardrailConfiguration_base {
754
+ }
755
+ declare const GuardrailStreamConfiguration_base: Schema.Class<GuardrailStreamConfiguration, Schema.Struct<{
756
+ readonly guardrailIdentifier: Schema.String;
757
+ readonly guardrailVersion: Schema.String;
758
+ readonly trace: Schema.optionalKey<Schema.Literals<readonly ["enabled", "disabled", "enabled_full"]>>;
759
+ readonly streamProcessingMode: Schema.optionalKey<Schema.Literals<readonly ["sync", "async"]>>;
760
+ }>, {}>;
761
+ /**
762
+ * The guardrail of a ConverseStream request.
763
+ *
764
+ * @stability unstable
765
+ * @category schemas
766
+ * @since 0.4.0
767
+ */
768
+ export declare class GuardrailStreamConfiguration extends GuardrailStreamConfiguration_base {
769
+ }
600
770
  declare const ConverseRequest_base: Schema.Class<ConverseRequest, Schema.Struct<{
601
771
  readonly modelId: Schema.String;
602
772
  readonly messages: Schema.$Array<typeof Message>;
603
773
  readonly system: Schema.optional<Schema.$Array<Schema.Struct<{
604
774
  readonly text: Schema.optional<Schema.String>;
605
775
  readonly cachePoint: Schema.optional<typeof CachePointBlock>;
776
+ readonly guardContent: Schema.optional<Schema.Struct<{
777
+ readonly text: Schema.optional<typeof GuardrailConverseTextBlock>;
778
+ readonly image: Schema.optional<typeof GuardrailConverseImageBlock>;
779
+ }>>;
606
780
  }>>>;
607
781
  readonly toolConfig: Schema.optionalKey<typeof ToolConfiguration>;
608
782
  readonly inferenceConfig: Schema.optional<typeof InferenceConfiguration>;
@@ -620,9 +794,10 @@ declare const ConverseRequest_base: Schema.Class<ConverseRequest, Schema.Struct<
620
794
  readonly effort: Schema.optionalKey<Schema.String>;
621
795
  }>>;
622
796
  readonly additionalModelRequestFields: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
797
+ readonly guardrailConfig: Schema.optional<typeof GuardrailConfiguration>;
623
798
  }>, {}>;
624
799
  /**
625
- * The request payload for the Converse and ConverseStream operations.
800
+ * The request payload for the Converse operation.
626
801
  *
627
802
  * **Details**
628
803
  *
@@ -641,6 +816,50 @@ declare const ConverseRequest_base: Schema.Class<ConverseRequest, Schema.Struct<
641
816
  */
642
817
  export declare class ConverseRequest extends ConverseRequest_base {
643
818
  }
819
+ declare const ConverseStreamRequest_base: Schema.Class<ConverseStreamRequest, Schema.Struct<{
820
+ readonly modelId: Schema.String;
821
+ readonly messages: Schema.$Array<typeof Message>;
822
+ readonly system: Schema.optional<Schema.$Array<Schema.Struct<{
823
+ readonly text: Schema.optional<Schema.String>;
824
+ readonly cachePoint: Schema.optional<typeof CachePointBlock>;
825
+ readonly guardContent: Schema.optional<Schema.Struct<{
826
+ readonly text: Schema.optional<typeof GuardrailConverseTextBlock>;
827
+ readonly image: Schema.optional<typeof GuardrailConverseImageBlock>;
828
+ }>>;
829
+ }>>>;
830
+ readonly toolConfig: Schema.optionalKey<typeof ToolConfiguration>;
831
+ readonly inferenceConfig: Schema.optional<typeof InferenceConfiguration>;
832
+ readonly outputConfig: Schema.optionalKey<Schema.Struct<{
833
+ readonly textFormat: Schema.optionalKey<Schema.Struct<{
834
+ readonly type: Schema.Literal<"json_schema">;
835
+ readonly structure: Schema.Struct<{
836
+ readonly jsonSchema: Schema.Struct<{
837
+ readonly schema: Schema.String;
838
+ readonly name: Schema.optionalKey<Schema.String>;
839
+ readonly description: Schema.optionalKey<Schema.String>;
840
+ }>;
841
+ }>;
842
+ }>>;
843
+ readonly effort: Schema.optionalKey<Schema.String>;
844
+ }>>;
845
+ readonly additionalModelRequestFields: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
846
+ readonly guardrailConfig: Schema.optional<typeof GuardrailStreamConfiguration>;
847
+ }>, {}>;
848
+ /**
849
+ * The request payload for the ConverseStream operation.
850
+ *
851
+ * **Details**
852
+ *
853
+ * The members of `ConverseRequest`, with the guardrail of a stream, which
854
+ * adds `streamProcessingMode`. That member is the only difference between the
855
+ * two operations.
856
+ *
857
+ * @stability unstable
858
+ * @category schemas
859
+ * @since 0.4.0
860
+ */
861
+ export declare class ConverseStreamRequest extends ConverseStreamRequest_base {
862
+ }
644
863
  declare const ConverseOutput_base: Schema.Class<ConverseOutput, Schema.Struct<{
645
864
  readonly message: typeof Message;
646
865
  }>, {}>;
@@ -668,12 +887,19 @@ export declare class ConverseMetrics extends ConverseMetrics_base {
668
887
  declare const ConverseResponse_base: Schema.Class<ConverseResponse, Schema.Struct<{
669
888
  readonly output: typeof ConverseOutput;
670
889
  readonly usage: typeof TokenUsage;
671
- readonly stopReason: Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>;
890
+ readonly stopReason: Schema.Union<readonly [Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>, Schema.StringForLiteralAutocomplete]>;
672
891
  readonly metrics: Schema.optional<typeof ConverseMetrics>;
892
+ readonly trace: Schema.optional<Schema.Codec<Schema.MutableJson, Schema.MutableJson, never, never>>;
673
893
  }>, {}>;
674
894
  /**
675
895
  * The response from a successful Converse call.
676
896
  *
897
+ * **Details**
898
+ *
899
+ * `trace` is kept as the JSON Bedrock sent. Its Smithy tree has about 90
900
+ * shapes that AWS still extends, and a struct would drop every member added
901
+ * later.
902
+ *
677
903
  * @stability unstable
678
904
  * @category schemas
679
905
  * @since 0.1.0
@@ -864,7 +1090,7 @@ declare const ContentBlockStartEvent_base: Schema.Class<ContentBlockStartEvent,
864
1090
  export declare class ContentBlockStartEvent extends ContentBlockStartEvent_base {
865
1091
  }
866
1092
  declare const MessageStopEvent_base: Schema.Class<MessageStopEvent, Schema.Struct<{
867
- readonly stopReason: Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>;
1093
+ readonly stopReason: Schema.Union<readonly [Schema.Literals<readonly ["end_turn", "tool_use", "max_tokens", "stop_sequence", "guardrail_intervened", "content_filtered", "malformed_model_output", "malformed_tool_use", "model_context_window_exceeded"]>, Schema.StringForLiteralAutocomplete]>;
868
1094
  }>, {}>;
869
1095
  /**
870
1096
  * The stop event for a streamed message.
@@ -878,9 +1104,16 @@ export declare class MessageStopEvent extends MessageStopEvent_base {
878
1104
  declare const ConverseStreamMetadataEvent_base: Schema.Class<ConverseStreamMetadataEvent, Schema.Struct<{
879
1105
  readonly usage: typeof TokenUsage;
880
1106
  readonly metrics: Schema.optional<typeof ConverseMetrics>;
1107
+ readonly trace: Schema.optional<Schema.Codec<Schema.MutableJson, Schema.MutableJson, never, never>>;
881
1108
  }>, {}>;
882
1109
  /**
883
- * The trailing metadata event for a Converse stream, carrying usage and metrics.
1110
+ * The trailing metadata event for a Converse stream, carrying usage, metrics,
1111
+ * and the trace.
1112
+ *
1113
+ * **Details**
1114
+ *
1115
+ * This is the only stream event that carries the trace. It is kept as JSON,
1116
+ * as in `ConverseResponse`.
884
1117
  *
885
1118
  * @stability unstable
886
1119
  * @category schemas
@@ -1 +1 @@
1
- {"version":3,"file":"AmazonBedrockSchema.d.ts","sourceRoot":"","sources":["../src/AmazonBedrockSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,MAAM,MAAM,eA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SAAQ,mBAKlC;CAAG;AAEL;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;EAK5B,CAAA;;;;;;;;;;;;;;;;AAEF;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,2BAK1C;CAAG;;;;AAEL;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,0BAIzC;CAAG;AAEL;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;EAG5B,CAAA;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;;;;EAE5B,CAAA;;;;;;;;;;AAEF;;;;;;;;;GASG;AACH,qBAAa,sBAAuB,SAAQ,2BAK1C;CAAG;;;;AAEL;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;;;;;;AAEL;;;;;;;;;;;;GAYG;AACH,qBAAa,2BAA4B,SAAQ,gCAM/C;CAAG;AAML;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6CtC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAC,IAAI,CAAA"}
@@ -24,14 +24,27 @@ const makeIdentifier = name => `${prefix}/${name}`;
24
24
  * @since 0.1.0
25
25
  */
26
26
  export const IntZeroOrGreater = /*#__PURE__*/Schema.Int.check(/*#__PURE__*/Schema.isGreaterThanOrEqualTo(0));
27
+ /**
28
+ * The stop reasons that the Smithy model of the Converse API names.
29
+ *
30
+ * @stability unstable
31
+ * @category schemas
32
+ * @since 0.3.0
33
+ */
34
+ export const KnownStopReason = /*#__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"]);
27
35
  /**
28
36
  * The reason the model stopped generating a response.
29
37
  *
38
+ * **Details**
39
+ *
40
+ * Any string decodes, so a reason that Bedrock adds later, or that a model
41
+ * returns outside the Smithy model, does not fail the response.
42
+ *
30
43
  * @stability unstable
31
44
  * @category schemas
32
45
  * @since 0.1.0
33
46
  */
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"]);
47
+ export const StopReason = /*#__PURE__*/Schema.Union([KnownStopReason, Schema.StringForLiteralAutocomplete]);
35
48
  /**
36
49
  * Token usage statistics returned by the Converse API.
37
50
  *
@@ -312,6 +325,73 @@ export class CitationsContentBlock extends /*#__PURE__*/Schema.Class(makeIdentif
312
325
  content: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(CitationTextContent)),
313
326
  citations: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Array(Citation))
314
327
  }) {}
328
+ /**
329
+ * The role a guarded text block plays in a contextual grounding check.
330
+ *
331
+ * **Details**
332
+ *
333
+ * `grounding_source` marks the documents an answer must be grounded in,
334
+ * `query` marks the question, and `guard_content` marks text the guardrail
335
+ * evaluates without a grounding role.
336
+ *
337
+ * @stability unstable
338
+ * @category schemas
339
+ * @since 0.4.0
340
+ */
341
+ export const GuardrailConverseContentQualifier = /*#__PURE__*/Schema.Literals(["grounding_source", "query", "guard_content"]);
342
+ /**
343
+ * Text that the guardrail evaluates.
344
+ *
345
+ * **Details**
346
+ *
347
+ * `qualifiers` uses `optionalKey` for the same reason as
348
+ * `CachePointBlock.ttl`: the block is built from `Prompt` provider options,
349
+ * whose values must satisfy `Schema.Json`.
350
+ *
351
+ * @stability unstable
352
+ * @category schemas
353
+ * @since 0.4.0
354
+ */
355
+ export class GuardrailConverseTextBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailConverseTextBlock"))({
356
+ text: Schema.String,
357
+ qualifiers: /*#__PURE__*/Schema.optionalKey(/*#__PURE__*/Schema.Array(GuardrailConverseContentQualifier))
358
+ }) {}
359
+ /**
360
+ * An image that the guardrail evaluates.
361
+ *
362
+ * **Details**
363
+ *
364
+ * The Smithy model allows only png and jpeg, and only `bytes` as the source.
365
+ * `bytes` is a Smithy blob, which the JSON protocol carries as a base64
366
+ * string.
367
+ *
368
+ * @stability unstable
369
+ * @category schemas
370
+ * @since 0.4.0
371
+ */
372
+ export class GuardrailConverseImageBlock extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailConverseImageBlock"))({
373
+ format: /*#__PURE__*/Schema.Literals(["png", "jpeg"]),
374
+ source: /*#__PURE__*/Schema.Struct({
375
+ bytes: Schema.String
376
+ })
377
+ }) {}
378
+ /**
379
+ * Content that the guardrail evaluates, in a message or in the system prompt.
380
+ *
381
+ * **Details**
382
+ *
383
+ * AWS models `GuardrailConverseContentBlock` as a UNION, so both members are
384
+ * optional here. Once a request holds one `guardContent` block, the guardrail
385
+ * evaluates only the guarded blocks. The model still reads every block.
386
+ *
387
+ * @stability unstable
388
+ * @category schemas
389
+ * @since 0.4.0
390
+ */
391
+ export const GuardrailConverseContentBlock = /*#__PURE__*/Schema.Struct({
392
+ text: /*#__PURE__*/Schema.optional(GuardrailConverseTextBlock),
393
+ image: /*#__PURE__*/Schema.optional(GuardrailConverseImageBlock)
394
+ });
315
395
  /**
316
396
  * A text content block within a Converse message.
317
397
  *
@@ -336,7 +416,8 @@ export const ContentBlock = /*#__PURE__*/Schema.Struct({
336
416
  image: /*#__PURE__*/Schema.optional(ImageBlock),
337
417
  document: /*#__PURE__*/Schema.optional(DocumentBlock),
338
418
  cachePoint: /*#__PURE__*/Schema.optional(CachePointBlock),
339
- citationsContent: /*#__PURE__*/Schema.optional(CitationsContentBlock)
419
+ citationsContent: /*#__PURE__*/Schema.optional(CitationsContentBlock),
420
+ guardContent: /*#__PURE__*/Schema.optional(GuardrailConverseContentBlock)
340
421
  });
341
422
  /**
342
423
  * A message within a Converse conversation.
@@ -354,8 +435,9 @@ export class Message extends /*#__PURE__*/Schema.Class(makeIdentifier("Message")
354
435
  *
355
436
  * **Details**
356
437
  *
357
- * AWS models `SystemContentBlock` as a UNION, so both members are optional; a
358
- * block carries either the system text or a cache point.
438
+ * AWS models `SystemContentBlock` as a UNION, so every member is optional; a
439
+ * block carries the system text, guarded system text, or a cache point. The
440
+ * guardrail evaluates the system prompt only where it is guarded.
359
441
  *
360
442
  * @stability unstable
361
443
  * @category schemas
@@ -363,7 +445,8 @@ export class Message extends /*#__PURE__*/Schema.Class(makeIdentifier("Message")
363
445
  */
364
446
  export const SystemContentBlock = /*#__PURE__*/Schema.Struct({
365
447
  text: /*#__PURE__*/Schema.optional(Schema.String),
366
- cachePoint: /*#__PURE__*/Schema.optional(CachePointBlock)
448
+ cachePoint: /*#__PURE__*/Schema.optional(CachePointBlock),
449
+ guardContent: /*#__PURE__*/Schema.optional(GuardrailConverseContentBlock)
367
450
  });
368
451
  /**
369
452
  * Base inference parameters to pass to a model in a Converse call.
@@ -494,7 +577,71 @@ export const OutputConfig = /*#__PURE__*/Schema.Struct({
494
577
  effort: /*#__PURE__*/Schema.optionalKey(Schema.String)
495
578
  });
496
579
  /**
497
- * The request payload for the Converse and ConverseStream operations.
580
+ * Whether Bedrock returns the guardrail trace.
581
+ *
582
+ * **Details**
583
+ *
584
+ * Bedrock's default is `disabled`. The trace holds the text that a policy
585
+ * matched, unmasked. `enabled_full` is in the Smithy model, and AWS does not
586
+ * document it.
587
+ *
588
+ * @stability unstable
589
+ * @category schemas
590
+ * @since 0.4.0
591
+ */
592
+ export const GuardrailTrace = /*#__PURE__*/Schema.Literals(["enabled", "disabled", "enabled_full"]);
593
+ /**
594
+ * How ConverseStream applies a guardrail to the streamed output.
595
+ *
596
+ * **Details**
597
+ *
598
+ * `sync`, Bedrock's default, holds back each chunk until the guardrail has
599
+ * evaluated it. `async` sends chunks at once, so text that the guardrail
600
+ * later blocks can reach the caller, and masking does not apply.
601
+ *
602
+ * @stability unstable
603
+ * @category schemas
604
+ * @since 0.4.0
605
+ */
606
+ export const GuardrailStreamProcessingMode = /*#__PURE__*/Schema.Literals(["sync", "async"]);
607
+ // Smithy gives the identifier and the version `default: ""`, and Bedrock cannot
608
+ // apply a guardrail without them, so both are required here.
609
+ const guardrailFields = {
610
+ guardrailIdentifier: Schema.String,
611
+ guardrailVersion: Schema.String,
612
+ trace: /*#__PURE__*/Schema.optionalKey(GuardrailTrace)
613
+ };
614
+ /**
615
+ * The guardrail of a Converse request.
616
+ *
617
+ * **Details**
618
+ *
619
+ * `guardrailIdentifier` is the guardrail's ID or ARN, and `guardrailVersion`
620
+ * is a version number or `DRAFT`. Converse has no `streamProcessingMode`, so
621
+ * the member is typed `never`: a ConverseStream request does not fit Converse
622
+ * until the mode is removed.
623
+ *
624
+ * @stability unstable
625
+ * @category schemas
626
+ * @since 0.4.0
627
+ */
628
+ export class GuardrailConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailConfiguration"))({
629
+ ...guardrailFields,
630
+ streamProcessingMode: /*#__PURE__*/Schema.optionalKey(Schema.Never)
631
+ }) {}
632
+ /**
633
+ * The guardrail of a ConverseStream request.
634
+ *
635
+ * @stability unstable
636
+ * @category schemas
637
+ * @since 0.4.0
638
+ */
639
+ export class GuardrailStreamConfiguration extends /*#__PURE__*/Schema.Class(makeIdentifier("GuardrailStreamConfiguration"))({
640
+ ...guardrailFields,
641
+ streamProcessingMode: /*#__PURE__*/Schema.optionalKey(GuardrailStreamProcessingMode)
642
+ }) {}
643
+ /**
644
+ * The request payload for the Converse operation.
498
645
  *
499
646
  * **Details**
500
647
  *
@@ -518,7 +665,25 @@ export class ConverseRequest extends /*#__PURE__*/Schema.Class(makeIdentifier("C
518
665
  toolConfig: /*#__PURE__*/Schema.optionalKey(ToolConfiguration),
519
666
  inferenceConfig: /*#__PURE__*/Schema.optional(InferenceConfiguration),
520
667
  outputConfig: /*#__PURE__*/Schema.optionalKey(OutputConfig),
521
- additionalModelRequestFields: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown))
668
+ additionalModelRequestFields: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record(Schema.String, Schema.Unknown)),
669
+ guardrailConfig: /*#__PURE__*/Schema.optional(GuardrailConfiguration)
670
+ }) {}
671
+ /**
672
+ * The request payload for the ConverseStream operation.
673
+ *
674
+ * **Details**
675
+ *
676
+ * The members of `ConverseRequest`, with the guardrail of a stream, which
677
+ * adds `streamProcessingMode`. That member is the only difference between the
678
+ * two operations.
679
+ *
680
+ * @stability unstable
681
+ * @category schemas
682
+ * @since 0.4.0
683
+ */
684
+ export class ConverseStreamRequest extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamRequest"))({
685
+ ...ConverseRequest.fields,
686
+ guardrailConfig: /*#__PURE__*/Schema.optional(GuardrailStreamConfiguration)
522
687
  }) {}
523
688
  // =============================================================================
524
689
  // Response
@@ -546,6 +711,12 @@ export class ConverseMetrics extends /*#__PURE__*/Schema.Class(makeIdentifier("C
546
711
  /**
547
712
  * The response from a successful Converse call.
548
713
  *
714
+ * **Details**
715
+ *
716
+ * `trace` is kept as the JSON Bedrock sent. Its Smithy tree has about 90
717
+ * shapes that AWS still extends, and a struct would drop every member added
718
+ * later.
719
+ *
549
720
  * @stability unstable
550
721
  * @category schemas
551
722
  * @since 0.1.0
@@ -554,7 +725,8 @@ export class ConverseResponse extends /*#__PURE__*/Schema.Class(makeIdentifier("
554
725
  output: ConverseOutput,
555
726
  usage: TokenUsage,
556
727
  stopReason: StopReason,
557
- metrics: /*#__PURE__*/Schema.optional(ConverseMetrics)
728
+ metrics: /*#__PURE__*/Schema.optional(ConverseMetrics),
729
+ trace: /*#__PURE__*/Schema.optional(Schema.MutableJson)
558
730
  }) {}
559
731
  // =============================================================================
560
732
  // Converse Stream Events
@@ -712,7 +884,13 @@ export class MessageStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("
712
884
  stopReason: StopReason
713
885
  }) {}
714
886
  /**
715
- * The trailing metadata event for a Converse stream, carrying usage and metrics.
887
+ * The trailing metadata event for a Converse stream, carrying usage, metrics,
888
+ * and the trace.
889
+ *
890
+ * **Details**
891
+ *
892
+ * This is the only stream event that carries the trace. It is kept as JSON,
893
+ * as in `ConverseResponse`.
716
894
  *
717
895
  * @stability unstable
718
896
  * @category schemas
@@ -720,7 +898,8 @@ export class MessageStopEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("
720
898
  */
721
899
  export class ConverseStreamMetadataEvent extends /*#__PURE__*/Schema.Class(makeIdentifier("ConverseStreamMetadataEvent"))({
722
900
  usage: TokenUsage,
723
- metrics: /*#__PURE__*/Schema.optional(ConverseMetrics)
901
+ metrics: /*#__PURE__*/Schema.optional(ConverseMetrics),
902
+ trace: /*#__PURE__*/Schema.optional(Schema.MutableJson)
724
903
  }) {}
725
904
  const ExceptionBody = /*#__PURE__*/Schema.Struct({
726
905
  message: /*#__PURE__*/Schema.optional(Schema.String)