types-boto3-bedrock-runtime 1.35.71__py3-none-any.whl

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.
@@ -0,0 +1,766 @@
1
+ """
2
+ Type annotations for bedrock-runtime service type definitions.
3
+
4
+ [Open documentation](https://youtype.github.io/types_boto3_docs/types_boto3_bedrock_runtime/type_defs/)
5
+
6
+ Usage::
7
+
8
+ ```python
9
+ from types_boto3_bedrock_runtime.type_defs import GuardrailOutputContentTypeDef
10
+
11
+ data: GuardrailOutputContentTypeDef = ...
12
+ ```
13
+
14
+ Copyright 2024 Vlad Emelianov
15
+ """
16
+
17
+ import sys
18
+ from typing import IO, Any, Dict, List, Mapping, Sequence, Union
19
+
20
+ from botocore.eventstream import EventStream
21
+ from botocore.response import StreamingBody
22
+
23
+ from .literals import (
24
+ ConversationRoleType,
25
+ DocumentFormatType,
26
+ GuardrailActionType,
27
+ GuardrailContentFilterConfidenceType,
28
+ GuardrailContentFilterStrengthType,
29
+ GuardrailContentFilterTypeType,
30
+ GuardrailContentQualifierType,
31
+ GuardrailContentSourceType,
32
+ GuardrailContextualGroundingFilterTypeType,
33
+ GuardrailContextualGroundingPolicyActionType,
34
+ GuardrailConverseContentQualifierType,
35
+ GuardrailPiiEntityTypeType,
36
+ GuardrailSensitiveInformationPolicyActionType,
37
+ GuardrailStreamProcessingModeType,
38
+ GuardrailTraceType,
39
+ ImageFormatType,
40
+ StopReasonType,
41
+ ToolResultStatusType,
42
+ TraceType,
43
+ )
44
+
45
+ if sys.version_info >= (3, 12):
46
+ from typing import Literal, NotRequired, TypedDict
47
+ else:
48
+ from typing_extensions import Literal, NotRequired, TypedDict
49
+
50
+
51
+ __all__ = (
52
+ "ApplyGuardrailRequestRequestTypeDef",
53
+ "ApplyGuardrailResponseTypeDef",
54
+ "BlobTypeDef",
55
+ "ContentBlockDeltaEventTypeDef",
56
+ "ContentBlockDeltaTypeDef",
57
+ "ContentBlockOutputTypeDef",
58
+ "ContentBlockStartEventTypeDef",
59
+ "ContentBlockStartTypeDef",
60
+ "ContentBlockStopEventTypeDef",
61
+ "ContentBlockTypeDef",
62
+ "ContentBlockUnionTypeDef",
63
+ "ConverseMetricsTypeDef",
64
+ "ConverseOutputTypeDef",
65
+ "ConverseRequestRequestTypeDef",
66
+ "ConverseResponseTypeDef",
67
+ "ConverseStreamMetadataEventTypeDef",
68
+ "ConverseStreamMetricsTypeDef",
69
+ "ConverseStreamOutputTypeDef",
70
+ "ConverseStreamRequestRequestTypeDef",
71
+ "ConverseStreamResponseTypeDef",
72
+ "ConverseStreamTraceTypeDef",
73
+ "ConverseTraceTypeDef",
74
+ "DocumentBlockOutputTypeDef",
75
+ "DocumentBlockTypeDef",
76
+ "DocumentBlockUnionTypeDef",
77
+ "DocumentSourceOutputTypeDef",
78
+ "DocumentSourceTypeDef",
79
+ "DocumentSourceUnionTypeDef",
80
+ "GuardrailAssessmentTypeDef",
81
+ "GuardrailConfigurationTypeDef",
82
+ "GuardrailContentBlockTypeDef",
83
+ "GuardrailContentFilterTypeDef",
84
+ "GuardrailContentPolicyAssessmentTypeDef",
85
+ "GuardrailContextualGroundingFilterTypeDef",
86
+ "GuardrailContextualGroundingPolicyAssessmentTypeDef",
87
+ "GuardrailConverseContentBlockOutputTypeDef",
88
+ "GuardrailConverseContentBlockTypeDef",
89
+ "GuardrailConverseContentBlockUnionTypeDef",
90
+ "GuardrailConverseTextBlockOutputTypeDef",
91
+ "GuardrailConverseTextBlockTypeDef",
92
+ "GuardrailConverseTextBlockUnionTypeDef",
93
+ "GuardrailCoverageTypeDef",
94
+ "GuardrailCustomWordTypeDef",
95
+ "GuardrailInvocationMetricsTypeDef",
96
+ "GuardrailManagedWordTypeDef",
97
+ "GuardrailOutputContentTypeDef",
98
+ "GuardrailPiiEntityFilterTypeDef",
99
+ "GuardrailRegexFilterTypeDef",
100
+ "GuardrailSensitiveInformationPolicyAssessmentTypeDef",
101
+ "GuardrailStreamConfigurationTypeDef",
102
+ "GuardrailTextBlockTypeDef",
103
+ "GuardrailTextCharactersCoverageTypeDef",
104
+ "GuardrailTopicPolicyAssessmentTypeDef",
105
+ "GuardrailTopicTypeDef",
106
+ "GuardrailTraceAssessmentTypeDef",
107
+ "GuardrailUsageTypeDef",
108
+ "GuardrailWordPolicyAssessmentTypeDef",
109
+ "ImageBlockOutputTypeDef",
110
+ "ImageBlockTypeDef",
111
+ "ImageBlockUnionTypeDef",
112
+ "ImageSourceOutputTypeDef",
113
+ "ImageSourceTypeDef",
114
+ "ImageSourceUnionTypeDef",
115
+ "InferenceConfigurationTypeDef",
116
+ "InternalServerExceptionTypeDef",
117
+ "InvokeModelRequestRequestTypeDef",
118
+ "InvokeModelResponseTypeDef",
119
+ "InvokeModelWithResponseStreamRequestRequestTypeDef",
120
+ "InvokeModelWithResponseStreamResponseTypeDef",
121
+ "MessageOutputTypeDef",
122
+ "MessageStartEventTypeDef",
123
+ "MessageStopEventTypeDef",
124
+ "MessageTypeDef",
125
+ "MessageUnionTypeDef",
126
+ "ModelStreamErrorExceptionTypeDef",
127
+ "ModelTimeoutExceptionTypeDef",
128
+ "PayloadPartTypeDef",
129
+ "PromptVariableValuesTypeDef",
130
+ "ResponseMetadataTypeDef",
131
+ "ResponseStreamTypeDef",
132
+ "ServiceUnavailableExceptionTypeDef",
133
+ "SpecificToolChoiceTypeDef",
134
+ "SystemContentBlockTypeDef",
135
+ "ThrottlingExceptionTypeDef",
136
+ "TokenUsageTypeDef",
137
+ "ToolChoiceTypeDef",
138
+ "ToolConfigurationTypeDef",
139
+ "ToolInputSchemaTypeDef",
140
+ "ToolResultBlockOutputTypeDef",
141
+ "ToolResultBlockTypeDef",
142
+ "ToolResultBlockUnionTypeDef",
143
+ "ToolResultContentBlockOutputTypeDef",
144
+ "ToolResultContentBlockTypeDef",
145
+ "ToolResultContentBlockUnionTypeDef",
146
+ "ToolSpecificationTypeDef",
147
+ "ToolTypeDef",
148
+ "ToolUseBlockDeltaTypeDef",
149
+ "ToolUseBlockOutputTypeDef",
150
+ "ToolUseBlockStartTypeDef",
151
+ "ToolUseBlockTypeDef",
152
+ "ToolUseBlockUnionTypeDef",
153
+ "ValidationExceptionTypeDef",
154
+ )
155
+
156
+
157
+ class GuardrailOutputContentTypeDef(TypedDict):
158
+ text: NotRequired[str]
159
+
160
+
161
+ class GuardrailUsageTypeDef(TypedDict):
162
+ topicPolicyUnits: int
163
+ contentPolicyUnits: int
164
+ wordPolicyUnits: int
165
+ sensitiveInformationPolicyUnits: int
166
+ sensitiveInformationPolicyFreeUnits: int
167
+ contextualGroundingPolicyUnits: int
168
+
169
+
170
+ class ResponseMetadataTypeDef(TypedDict):
171
+ RequestId: str
172
+ HTTPStatusCode: int
173
+ HTTPHeaders: Dict[str, str]
174
+ RetryAttempts: int
175
+ HostId: NotRequired[str]
176
+
177
+
178
+ BlobTypeDef = Union[str, bytes, IO[Any], StreamingBody]
179
+ ToolUseBlockDeltaTypeDef = TypedDict(
180
+ "ToolUseBlockDeltaTypeDef",
181
+ {
182
+ "input": str,
183
+ },
184
+ )
185
+ ToolUseBlockOutputTypeDef = TypedDict(
186
+ "ToolUseBlockOutputTypeDef",
187
+ {
188
+ "toolUseId": str,
189
+ "name": str,
190
+ "input": Dict[str, Any],
191
+ },
192
+ )
193
+
194
+
195
+ class ToolUseBlockStartTypeDef(TypedDict):
196
+ toolUseId: str
197
+ name: str
198
+
199
+
200
+ class ContentBlockStopEventTypeDef(TypedDict):
201
+ contentBlockIndex: int
202
+
203
+
204
+ class ConverseMetricsTypeDef(TypedDict):
205
+ latencyMs: int
206
+
207
+
208
+ class GuardrailConfigurationTypeDef(TypedDict):
209
+ guardrailIdentifier: str
210
+ guardrailVersion: str
211
+ trace: NotRequired[GuardrailTraceType]
212
+
213
+
214
+ class InferenceConfigurationTypeDef(TypedDict):
215
+ maxTokens: NotRequired[int]
216
+ temperature: NotRequired[float]
217
+ topP: NotRequired[float]
218
+ stopSequences: NotRequired[Sequence[str]]
219
+
220
+
221
+ class PromptVariableValuesTypeDef(TypedDict):
222
+ text: NotRequired[str]
223
+
224
+
225
+ class TokenUsageTypeDef(TypedDict):
226
+ inputTokens: int
227
+ outputTokens: int
228
+ totalTokens: int
229
+
230
+
231
+ class ConverseStreamMetricsTypeDef(TypedDict):
232
+ latencyMs: int
233
+
234
+
235
+ class InternalServerExceptionTypeDef(TypedDict):
236
+ message: NotRequired[str]
237
+
238
+
239
+ class MessageStartEventTypeDef(TypedDict):
240
+ role: ConversationRoleType
241
+
242
+
243
+ class MessageStopEventTypeDef(TypedDict):
244
+ stopReason: StopReasonType
245
+ additionalModelResponseFields: NotRequired[Dict[str, Any]]
246
+
247
+
248
+ class ModelStreamErrorExceptionTypeDef(TypedDict):
249
+ message: NotRequired[str]
250
+ originalStatusCode: NotRequired[int]
251
+ originalMessage: NotRequired[str]
252
+
253
+
254
+ class ServiceUnavailableExceptionTypeDef(TypedDict):
255
+ message: NotRequired[str]
256
+
257
+
258
+ class ThrottlingExceptionTypeDef(TypedDict):
259
+ message: NotRequired[str]
260
+
261
+
262
+ class ValidationExceptionTypeDef(TypedDict):
263
+ message: NotRequired[str]
264
+
265
+
266
+ class GuardrailStreamConfigurationTypeDef(TypedDict):
267
+ guardrailIdentifier: str
268
+ guardrailVersion: str
269
+ trace: NotRequired[GuardrailTraceType]
270
+ streamProcessingMode: NotRequired[GuardrailStreamProcessingModeType]
271
+
272
+
273
+ DocumentSourceOutputTypeDef = TypedDict(
274
+ "DocumentSourceOutputTypeDef",
275
+ {
276
+ "bytes": NotRequired[bytes],
277
+ },
278
+ )
279
+
280
+
281
+ class GuardrailTextBlockTypeDef(TypedDict):
282
+ text: str
283
+ qualifiers: NotRequired[Sequence[GuardrailContentQualifierType]]
284
+
285
+
286
+ GuardrailContentFilterTypeDef = TypedDict(
287
+ "GuardrailContentFilterTypeDef",
288
+ {
289
+ "type": GuardrailContentFilterTypeType,
290
+ "confidence": GuardrailContentFilterConfidenceType,
291
+ "action": Literal["BLOCKED"],
292
+ "filterStrength": NotRequired[GuardrailContentFilterStrengthType],
293
+ },
294
+ )
295
+ GuardrailContextualGroundingFilterTypeDef = TypedDict(
296
+ "GuardrailContextualGroundingFilterTypeDef",
297
+ {
298
+ "type": GuardrailContextualGroundingFilterTypeType,
299
+ "threshold": float,
300
+ "score": float,
301
+ "action": GuardrailContextualGroundingPolicyActionType,
302
+ },
303
+ )
304
+
305
+
306
+ class GuardrailConverseTextBlockOutputTypeDef(TypedDict):
307
+ text: str
308
+ qualifiers: NotRequired[List[GuardrailConverseContentQualifierType]]
309
+
310
+
311
+ class GuardrailConverseTextBlockTypeDef(TypedDict):
312
+ text: str
313
+ qualifiers: NotRequired[Sequence[GuardrailConverseContentQualifierType]]
314
+
315
+
316
+ class GuardrailTextCharactersCoverageTypeDef(TypedDict):
317
+ guarded: NotRequired[int]
318
+ total: NotRequired[int]
319
+
320
+
321
+ class GuardrailCustomWordTypeDef(TypedDict):
322
+ match: str
323
+ action: Literal["BLOCKED"]
324
+
325
+
326
+ GuardrailManagedWordTypeDef = TypedDict(
327
+ "GuardrailManagedWordTypeDef",
328
+ {
329
+ "match": str,
330
+ "type": Literal["PROFANITY"],
331
+ "action": Literal["BLOCKED"],
332
+ },
333
+ )
334
+ GuardrailPiiEntityFilterTypeDef = TypedDict(
335
+ "GuardrailPiiEntityFilterTypeDef",
336
+ {
337
+ "match": str,
338
+ "type": GuardrailPiiEntityTypeType,
339
+ "action": GuardrailSensitiveInformationPolicyActionType,
340
+ },
341
+ )
342
+
343
+
344
+ class GuardrailRegexFilterTypeDef(TypedDict):
345
+ action: GuardrailSensitiveInformationPolicyActionType
346
+ name: NotRequired[str]
347
+ match: NotRequired[str]
348
+ regex: NotRequired[str]
349
+
350
+
351
+ GuardrailTopicTypeDef = TypedDict(
352
+ "GuardrailTopicTypeDef",
353
+ {
354
+ "name": str,
355
+ "type": Literal["DENY"],
356
+ "action": Literal["BLOCKED"],
357
+ },
358
+ )
359
+ ImageSourceOutputTypeDef = TypedDict(
360
+ "ImageSourceOutputTypeDef",
361
+ {
362
+ "bytes": NotRequired[bytes],
363
+ },
364
+ )
365
+
366
+
367
+ class ModelTimeoutExceptionTypeDef(TypedDict):
368
+ message: NotRequired[str]
369
+
370
+
371
+ PayloadPartTypeDef = TypedDict(
372
+ "PayloadPartTypeDef",
373
+ {
374
+ "bytes": NotRequired[bytes],
375
+ },
376
+ )
377
+
378
+
379
+ class SpecificToolChoiceTypeDef(TypedDict):
380
+ name: str
381
+
382
+
383
+ class ToolInputSchemaTypeDef(TypedDict):
384
+ json: NotRequired[Mapping[str, Any]]
385
+
386
+
387
+ ToolUseBlockTypeDef = TypedDict(
388
+ "ToolUseBlockTypeDef",
389
+ {
390
+ "toolUseId": str,
391
+ "name": str,
392
+ "input": Mapping[str, Any],
393
+ },
394
+ )
395
+
396
+
397
+ class InvokeModelResponseTypeDef(TypedDict):
398
+ body: StreamingBody
399
+ contentType: str
400
+ ResponseMetadata: ResponseMetadataTypeDef
401
+
402
+
403
+ DocumentSourceTypeDef = TypedDict(
404
+ "DocumentSourceTypeDef",
405
+ {
406
+ "bytes": NotRequired[BlobTypeDef],
407
+ },
408
+ )
409
+ ImageSourceTypeDef = TypedDict(
410
+ "ImageSourceTypeDef",
411
+ {
412
+ "bytes": NotRequired[BlobTypeDef],
413
+ },
414
+ )
415
+
416
+
417
+ class InvokeModelRequestRequestTypeDef(TypedDict):
418
+ modelId: str
419
+ body: NotRequired[BlobTypeDef]
420
+ contentType: NotRequired[str]
421
+ accept: NotRequired[str]
422
+ trace: NotRequired[TraceType]
423
+ guardrailIdentifier: NotRequired[str]
424
+ guardrailVersion: NotRequired[str]
425
+
426
+
427
+ class InvokeModelWithResponseStreamRequestRequestTypeDef(TypedDict):
428
+ modelId: str
429
+ body: NotRequired[BlobTypeDef]
430
+ contentType: NotRequired[str]
431
+ accept: NotRequired[str]
432
+ trace: NotRequired[TraceType]
433
+ guardrailIdentifier: NotRequired[str]
434
+ guardrailVersion: NotRequired[str]
435
+
436
+
437
+ class ContentBlockDeltaTypeDef(TypedDict):
438
+ text: NotRequired[str]
439
+ toolUse: NotRequired[ToolUseBlockDeltaTypeDef]
440
+
441
+
442
+ class ContentBlockStartTypeDef(TypedDict):
443
+ toolUse: NotRequired[ToolUseBlockStartTypeDef]
444
+
445
+
446
+ DocumentBlockOutputTypeDef = TypedDict(
447
+ "DocumentBlockOutputTypeDef",
448
+ {
449
+ "format": DocumentFormatType,
450
+ "name": str,
451
+ "source": DocumentSourceOutputTypeDef,
452
+ },
453
+ )
454
+
455
+
456
+ class GuardrailContentBlockTypeDef(TypedDict):
457
+ text: NotRequired[GuardrailTextBlockTypeDef]
458
+
459
+
460
+ class GuardrailContentPolicyAssessmentTypeDef(TypedDict):
461
+ filters: List[GuardrailContentFilterTypeDef]
462
+
463
+
464
+ class GuardrailContextualGroundingPolicyAssessmentTypeDef(TypedDict):
465
+ filters: NotRequired[List[GuardrailContextualGroundingFilterTypeDef]]
466
+
467
+
468
+ class GuardrailConverseContentBlockOutputTypeDef(TypedDict):
469
+ text: NotRequired[GuardrailConverseTextBlockOutputTypeDef]
470
+
471
+
472
+ GuardrailConverseTextBlockUnionTypeDef = Union[
473
+ GuardrailConverseTextBlockTypeDef, GuardrailConverseTextBlockOutputTypeDef
474
+ ]
475
+
476
+
477
+ class GuardrailCoverageTypeDef(TypedDict):
478
+ textCharacters: NotRequired[GuardrailTextCharactersCoverageTypeDef]
479
+
480
+
481
+ class GuardrailWordPolicyAssessmentTypeDef(TypedDict):
482
+ customWords: List[GuardrailCustomWordTypeDef]
483
+ managedWordLists: List[GuardrailManagedWordTypeDef]
484
+
485
+
486
+ class GuardrailSensitiveInformationPolicyAssessmentTypeDef(TypedDict):
487
+ piiEntities: List[GuardrailPiiEntityFilterTypeDef]
488
+ regexes: List[GuardrailRegexFilterTypeDef]
489
+
490
+
491
+ class GuardrailTopicPolicyAssessmentTypeDef(TypedDict):
492
+ topics: List[GuardrailTopicTypeDef]
493
+
494
+
495
+ ImageBlockOutputTypeDef = TypedDict(
496
+ "ImageBlockOutputTypeDef",
497
+ {
498
+ "format": ImageFormatType,
499
+ "source": ImageSourceOutputTypeDef,
500
+ },
501
+ )
502
+
503
+
504
+ class ResponseStreamTypeDef(TypedDict):
505
+ chunk: NotRequired[PayloadPartTypeDef]
506
+ internalServerException: NotRequired[InternalServerExceptionTypeDef]
507
+ modelStreamErrorException: NotRequired[ModelStreamErrorExceptionTypeDef]
508
+ validationException: NotRequired[ValidationExceptionTypeDef]
509
+ throttlingException: NotRequired[ThrottlingExceptionTypeDef]
510
+ modelTimeoutException: NotRequired[ModelTimeoutExceptionTypeDef]
511
+ serviceUnavailableException: NotRequired[ServiceUnavailableExceptionTypeDef]
512
+
513
+
514
+ ToolChoiceTypeDef = TypedDict(
515
+ "ToolChoiceTypeDef",
516
+ {
517
+ "auto": NotRequired[Mapping[str, Any]],
518
+ "any": NotRequired[Mapping[str, Any]],
519
+ "tool": NotRequired[SpecificToolChoiceTypeDef],
520
+ },
521
+ )
522
+
523
+
524
+ class ToolSpecificationTypeDef(TypedDict):
525
+ name: str
526
+ inputSchema: ToolInputSchemaTypeDef
527
+ description: NotRequired[str]
528
+
529
+
530
+ ToolUseBlockUnionTypeDef = Union[ToolUseBlockTypeDef, ToolUseBlockOutputTypeDef]
531
+ DocumentSourceUnionTypeDef = Union[DocumentSourceTypeDef, DocumentSourceOutputTypeDef]
532
+ ImageSourceUnionTypeDef = Union[ImageSourceTypeDef, ImageSourceOutputTypeDef]
533
+
534
+
535
+ class ContentBlockDeltaEventTypeDef(TypedDict):
536
+ delta: ContentBlockDeltaTypeDef
537
+ contentBlockIndex: int
538
+
539
+
540
+ class ContentBlockStartEventTypeDef(TypedDict):
541
+ start: ContentBlockStartTypeDef
542
+ contentBlockIndex: int
543
+
544
+
545
+ class ApplyGuardrailRequestRequestTypeDef(TypedDict):
546
+ guardrailIdentifier: str
547
+ guardrailVersion: str
548
+ source: GuardrailContentSourceType
549
+ content: Sequence[GuardrailContentBlockTypeDef]
550
+
551
+
552
+ class GuardrailConverseContentBlockTypeDef(TypedDict):
553
+ text: NotRequired[GuardrailConverseTextBlockUnionTypeDef]
554
+
555
+
556
+ class GuardrailInvocationMetricsTypeDef(TypedDict):
557
+ guardrailProcessingLatency: NotRequired[int]
558
+ usage: NotRequired[GuardrailUsageTypeDef]
559
+ guardrailCoverage: NotRequired[GuardrailCoverageTypeDef]
560
+
561
+
562
+ class ToolResultContentBlockOutputTypeDef(TypedDict):
563
+ json: NotRequired[Dict[str, Any]]
564
+ text: NotRequired[str]
565
+ image: NotRequired[ImageBlockOutputTypeDef]
566
+ document: NotRequired[DocumentBlockOutputTypeDef]
567
+
568
+
569
+ class InvokeModelWithResponseStreamResponseTypeDef(TypedDict):
570
+ body: "EventStream[ResponseStreamTypeDef]"
571
+ contentType: str
572
+ ResponseMetadata: ResponseMetadataTypeDef
573
+
574
+
575
+ class ToolTypeDef(TypedDict):
576
+ toolSpec: NotRequired[ToolSpecificationTypeDef]
577
+
578
+
579
+ DocumentBlockTypeDef = TypedDict(
580
+ "DocumentBlockTypeDef",
581
+ {
582
+ "format": DocumentFormatType,
583
+ "name": str,
584
+ "source": DocumentSourceUnionTypeDef,
585
+ },
586
+ )
587
+ ImageBlockTypeDef = TypedDict(
588
+ "ImageBlockTypeDef",
589
+ {
590
+ "format": ImageFormatType,
591
+ "source": ImageSourceUnionTypeDef,
592
+ },
593
+ )
594
+ GuardrailConverseContentBlockUnionTypeDef = Union[
595
+ GuardrailConverseContentBlockTypeDef, GuardrailConverseContentBlockOutputTypeDef
596
+ ]
597
+
598
+
599
+ class GuardrailAssessmentTypeDef(TypedDict):
600
+ topicPolicy: NotRequired[GuardrailTopicPolicyAssessmentTypeDef]
601
+ contentPolicy: NotRequired[GuardrailContentPolicyAssessmentTypeDef]
602
+ wordPolicy: NotRequired[GuardrailWordPolicyAssessmentTypeDef]
603
+ sensitiveInformationPolicy: NotRequired[GuardrailSensitiveInformationPolicyAssessmentTypeDef]
604
+ contextualGroundingPolicy: NotRequired[GuardrailContextualGroundingPolicyAssessmentTypeDef]
605
+ invocationMetrics: NotRequired[GuardrailInvocationMetricsTypeDef]
606
+
607
+
608
+ class ToolResultBlockOutputTypeDef(TypedDict):
609
+ toolUseId: str
610
+ content: List[ToolResultContentBlockOutputTypeDef]
611
+ status: NotRequired[ToolResultStatusType]
612
+
613
+
614
+ class ToolConfigurationTypeDef(TypedDict):
615
+ tools: Sequence[ToolTypeDef]
616
+ toolChoice: NotRequired[ToolChoiceTypeDef]
617
+
618
+
619
+ DocumentBlockUnionTypeDef = Union[DocumentBlockTypeDef, DocumentBlockOutputTypeDef]
620
+ ImageBlockUnionTypeDef = Union[ImageBlockTypeDef, ImageBlockOutputTypeDef]
621
+
622
+
623
+ class SystemContentBlockTypeDef(TypedDict):
624
+ text: NotRequired[str]
625
+ guardContent: NotRequired[GuardrailConverseContentBlockUnionTypeDef]
626
+
627
+
628
+ class ApplyGuardrailResponseTypeDef(TypedDict):
629
+ usage: GuardrailUsageTypeDef
630
+ action: GuardrailActionType
631
+ outputs: List[GuardrailOutputContentTypeDef]
632
+ assessments: List[GuardrailAssessmentTypeDef]
633
+ guardrailCoverage: GuardrailCoverageTypeDef
634
+ ResponseMetadata: ResponseMetadataTypeDef
635
+
636
+
637
+ class GuardrailTraceAssessmentTypeDef(TypedDict):
638
+ modelOutput: NotRequired[List[str]]
639
+ inputAssessment: NotRequired[Dict[str, GuardrailAssessmentTypeDef]]
640
+ outputAssessments: NotRequired[Dict[str, List[GuardrailAssessmentTypeDef]]]
641
+
642
+
643
+ class ContentBlockOutputTypeDef(TypedDict):
644
+ text: NotRequired[str]
645
+ image: NotRequired[ImageBlockOutputTypeDef]
646
+ document: NotRequired[DocumentBlockOutputTypeDef]
647
+ toolUse: NotRequired[ToolUseBlockOutputTypeDef]
648
+ toolResult: NotRequired[ToolResultBlockOutputTypeDef]
649
+ guardContent: NotRequired[GuardrailConverseContentBlockOutputTypeDef]
650
+
651
+
652
+ class ToolResultContentBlockTypeDef(TypedDict):
653
+ json: NotRequired[Mapping[str, Any]]
654
+ text: NotRequired[str]
655
+ image: NotRequired[ImageBlockUnionTypeDef]
656
+ document: NotRequired[DocumentBlockUnionTypeDef]
657
+
658
+
659
+ class ConverseStreamTraceTypeDef(TypedDict):
660
+ guardrail: NotRequired[GuardrailTraceAssessmentTypeDef]
661
+
662
+
663
+ class ConverseTraceTypeDef(TypedDict):
664
+ guardrail: NotRequired[GuardrailTraceAssessmentTypeDef]
665
+
666
+
667
+ class MessageOutputTypeDef(TypedDict):
668
+ role: ConversationRoleType
669
+ content: List[ContentBlockOutputTypeDef]
670
+
671
+
672
+ ToolResultContentBlockUnionTypeDef = Union[
673
+ ToolResultContentBlockTypeDef, ToolResultContentBlockOutputTypeDef
674
+ ]
675
+
676
+
677
+ class ConverseStreamMetadataEventTypeDef(TypedDict):
678
+ usage: TokenUsageTypeDef
679
+ metrics: ConverseStreamMetricsTypeDef
680
+ trace: NotRequired[ConverseStreamTraceTypeDef]
681
+
682
+
683
+ class ConverseOutputTypeDef(TypedDict):
684
+ message: NotRequired[MessageOutputTypeDef]
685
+
686
+
687
+ class ToolResultBlockTypeDef(TypedDict):
688
+ toolUseId: str
689
+ content: Sequence[ToolResultContentBlockUnionTypeDef]
690
+ status: NotRequired[ToolResultStatusType]
691
+
692
+
693
+ class ConverseStreamOutputTypeDef(TypedDict):
694
+ messageStart: NotRequired[MessageStartEventTypeDef]
695
+ contentBlockStart: NotRequired[ContentBlockStartEventTypeDef]
696
+ contentBlockDelta: NotRequired[ContentBlockDeltaEventTypeDef]
697
+ contentBlockStop: NotRequired[ContentBlockStopEventTypeDef]
698
+ messageStop: NotRequired[MessageStopEventTypeDef]
699
+ metadata: NotRequired[ConverseStreamMetadataEventTypeDef]
700
+ internalServerException: NotRequired[InternalServerExceptionTypeDef]
701
+ modelStreamErrorException: NotRequired[ModelStreamErrorExceptionTypeDef]
702
+ validationException: NotRequired[ValidationExceptionTypeDef]
703
+ throttlingException: NotRequired[ThrottlingExceptionTypeDef]
704
+ serviceUnavailableException: NotRequired[ServiceUnavailableExceptionTypeDef]
705
+
706
+
707
+ class ConverseResponseTypeDef(TypedDict):
708
+ output: ConverseOutputTypeDef
709
+ stopReason: StopReasonType
710
+ usage: TokenUsageTypeDef
711
+ metrics: ConverseMetricsTypeDef
712
+ additionalModelResponseFields: Dict[str, Any]
713
+ trace: ConverseTraceTypeDef
714
+ ResponseMetadata: ResponseMetadataTypeDef
715
+
716
+
717
+ ToolResultBlockUnionTypeDef = Union[ToolResultBlockTypeDef, ToolResultBlockOutputTypeDef]
718
+
719
+
720
+ class ConverseStreamResponseTypeDef(TypedDict):
721
+ stream: "EventStream[ConverseStreamOutputTypeDef]"
722
+ ResponseMetadata: ResponseMetadataTypeDef
723
+
724
+
725
+ class ContentBlockTypeDef(TypedDict):
726
+ text: NotRequired[str]
727
+ image: NotRequired[ImageBlockUnionTypeDef]
728
+ document: NotRequired[DocumentBlockUnionTypeDef]
729
+ toolUse: NotRequired[ToolUseBlockUnionTypeDef]
730
+ toolResult: NotRequired[ToolResultBlockUnionTypeDef]
731
+ guardContent: NotRequired[GuardrailConverseContentBlockUnionTypeDef]
732
+
733
+
734
+ ContentBlockUnionTypeDef = Union[ContentBlockTypeDef, ContentBlockOutputTypeDef]
735
+
736
+
737
+ class MessageTypeDef(TypedDict):
738
+ role: ConversationRoleType
739
+ content: Sequence[ContentBlockUnionTypeDef]
740
+
741
+
742
+ class ConverseStreamRequestRequestTypeDef(TypedDict):
743
+ modelId: str
744
+ messages: NotRequired[Sequence[MessageTypeDef]]
745
+ system: NotRequired[Sequence[SystemContentBlockTypeDef]]
746
+ inferenceConfig: NotRequired[InferenceConfigurationTypeDef]
747
+ toolConfig: NotRequired[ToolConfigurationTypeDef]
748
+ guardrailConfig: NotRequired[GuardrailStreamConfigurationTypeDef]
749
+ additionalModelRequestFields: NotRequired[Mapping[str, Any]]
750
+ promptVariables: NotRequired[Mapping[str, PromptVariableValuesTypeDef]]
751
+ additionalModelResponseFieldPaths: NotRequired[Sequence[str]]
752
+
753
+
754
+ MessageUnionTypeDef = Union[MessageTypeDef, MessageOutputTypeDef]
755
+
756
+
757
+ class ConverseRequestRequestTypeDef(TypedDict):
758
+ modelId: str
759
+ messages: NotRequired[Sequence[MessageUnionTypeDef]]
760
+ system: NotRequired[Sequence[SystemContentBlockTypeDef]]
761
+ inferenceConfig: NotRequired[InferenceConfigurationTypeDef]
762
+ toolConfig: NotRequired[ToolConfigurationTypeDef]
763
+ guardrailConfig: NotRequired[GuardrailConfigurationTypeDef]
764
+ additionalModelRequestFields: NotRequired[Mapping[str, Any]]
765
+ promptVariables: NotRequired[Mapping[str, PromptVariableValuesTypeDef]]
766
+ additionalModelResponseFieldPaths: NotRequired[Sequence[str]]