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,674 @@
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
+ __all__ = (
51
+ "ApplyGuardrailRequestRequestTypeDef",
52
+ "ApplyGuardrailResponseTypeDef",
53
+ "BlobTypeDef",
54
+ "ContentBlockDeltaEventTypeDef",
55
+ "ContentBlockDeltaTypeDef",
56
+ "ContentBlockOutputTypeDef",
57
+ "ContentBlockStartEventTypeDef",
58
+ "ContentBlockStartTypeDef",
59
+ "ContentBlockStopEventTypeDef",
60
+ "ContentBlockTypeDef",
61
+ "ContentBlockUnionTypeDef",
62
+ "ConverseMetricsTypeDef",
63
+ "ConverseOutputTypeDef",
64
+ "ConverseRequestRequestTypeDef",
65
+ "ConverseResponseTypeDef",
66
+ "ConverseStreamMetadataEventTypeDef",
67
+ "ConverseStreamMetricsTypeDef",
68
+ "ConverseStreamOutputTypeDef",
69
+ "ConverseStreamRequestRequestTypeDef",
70
+ "ConverseStreamResponseTypeDef",
71
+ "ConverseStreamTraceTypeDef",
72
+ "ConverseTraceTypeDef",
73
+ "DocumentBlockOutputTypeDef",
74
+ "DocumentBlockTypeDef",
75
+ "DocumentBlockUnionTypeDef",
76
+ "DocumentSourceOutputTypeDef",
77
+ "DocumentSourceTypeDef",
78
+ "DocumentSourceUnionTypeDef",
79
+ "GuardrailAssessmentTypeDef",
80
+ "GuardrailConfigurationTypeDef",
81
+ "GuardrailContentBlockTypeDef",
82
+ "GuardrailContentFilterTypeDef",
83
+ "GuardrailContentPolicyAssessmentTypeDef",
84
+ "GuardrailContextualGroundingFilterTypeDef",
85
+ "GuardrailContextualGroundingPolicyAssessmentTypeDef",
86
+ "GuardrailConverseContentBlockOutputTypeDef",
87
+ "GuardrailConverseContentBlockTypeDef",
88
+ "GuardrailConverseContentBlockUnionTypeDef",
89
+ "GuardrailConverseTextBlockOutputTypeDef",
90
+ "GuardrailConverseTextBlockTypeDef",
91
+ "GuardrailConverseTextBlockUnionTypeDef",
92
+ "GuardrailCoverageTypeDef",
93
+ "GuardrailCustomWordTypeDef",
94
+ "GuardrailInvocationMetricsTypeDef",
95
+ "GuardrailManagedWordTypeDef",
96
+ "GuardrailOutputContentTypeDef",
97
+ "GuardrailPiiEntityFilterTypeDef",
98
+ "GuardrailRegexFilterTypeDef",
99
+ "GuardrailSensitiveInformationPolicyAssessmentTypeDef",
100
+ "GuardrailStreamConfigurationTypeDef",
101
+ "GuardrailTextBlockTypeDef",
102
+ "GuardrailTextCharactersCoverageTypeDef",
103
+ "GuardrailTopicPolicyAssessmentTypeDef",
104
+ "GuardrailTopicTypeDef",
105
+ "GuardrailTraceAssessmentTypeDef",
106
+ "GuardrailUsageTypeDef",
107
+ "GuardrailWordPolicyAssessmentTypeDef",
108
+ "ImageBlockOutputTypeDef",
109
+ "ImageBlockTypeDef",
110
+ "ImageBlockUnionTypeDef",
111
+ "ImageSourceOutputTypeDef",
112
+ "ImageSourceTypeDef",
113
+ "ImageSourceUnionTypeDef",
114
+ "InferenceConfigurationTypeDef",
115
+ "InternalServerExceptionTypeDef",
116
+ "InvokeModelRequestRequestTypeDef",
117
+ "InvokeModelResponseTypeDef",
118
+ "InvokeModelWithResponseStreamRequestRequestTypeDef",
119
+ "InvokeModelWithResponseStreamResponseTypeDef",
120
+ "MessageOutputTypeDef",
121
+ "MessageStartEventTypeDef",
122
+ "MessageStopEventTypeDef",
123
+ "MessageTypeDef",
124
+ "MessageUnionTypeDef",
125
+ "ModelStreamErrorExceptionTypeDef",
126
+ "ModelTimeoutExceptionTypeDef",
127
+ "PayloadPartTypeDef",
128
+ "PromptVariableValuesTypeDef",
129
+ "ResponseMetadataTypeDef",
130
+ "ResponseStreamTypeDef",
131
+ "ServiceUnavailableExceptionTypeDef",
132
+ "SpecificToolChoiceTypeDef",
133
+ "SystemContentBlockTypeDef",
134
+ "ThrottlingExceptionTypeDef",
135
+ "TokenUsageTypeDef",
136
+ "ToolChoiceTypeDef",
137
+ "ToolConfigurationTypeDef",
138
+ "ToolInputSchemaTypeDef",
139
+ "ToolResultBlockOutputTypeDef",
140
+ "ToolResultBlockTypeDef",
141
+ "ToolResultBlockUnionTypeDef",
142
+ "ToolResultContentBlockOutputTypeDef",
143
+ "ToolResultContentBlockTypeDef",
144
+ "ToolResultContentBlockUnionTypeDef",
145
+ "ToolSpecificationTypeDef",
146
+ "ToolTypeDef",
147
+ "ToolUseBlockDeltaTypeDef",
148
+ "ToolUseBlockOutputTypeDef",
149
+ "ToolUseBlockStartTypeDef",
150
+ "ToolUseBlockTypeDef",
151
+ "ToolUseBlockUnionTypeDef",
152
+ "ValidationExceptionTypeDef",
153
+ )
154
+
155
+ class GuardrailOutputContentTypeDef(TypedDict):
156
+ text: NotRequired[str]
157
+
158
+ class GuardrailUsageTypeDef(TypedDict):
159
+ topicPolicyUnits: int
160
+ contentPolicyUnits: int
161
+ wordPolicyUnits: int
162
+ sensitiveInformationPolicyUnits: int
163
+ sensitiveInformationPolicyFreeUnits: int
164
+ contextualGroundingPolicyUnits: int
165
+
166
+ class ResponseMetadataTypeDef(TypedDict):
167
+ RequestId: str
168
+ HTTPStatusCode: int
169
+ HTTPHeaders: Dict[str, str]
170
+ RetryAttempts: int
171
+ HostId: NotRequired[str]
172
+
173
+ BlobTypeDef = Union[str, bytes, IO[Any], StreamingBody]
174
+ ToolUseBlockDeltaTypeDef = TypedDict(
175
+ "ToolUseBlockDeltaTypeDef",
176
+ {
177
+ "input": str,
178
+ },
179
+ )
180
+ ToolUseBlockOutputTypeDef = TypedDict(
181
+ "ToolUseBlockOutputTypeDef",
182
+ {
183
+ "toolUseId": str,
184
+ "name": str,
185
+ "input": Dict[str, Any],
186
+ },
187
+ )
188
+
189
+ class ToolUseBlockStartTypeDef(TypedDict):
190
+ toolUseId: str
191
+ name: str
192
+
193
+ class ContentBlockStopEventTypeDef(TypedDict):
194
+ contentBlockIndex: int
195
+
196
+ class ConverseMetricsTypeDef(TypedDict):
197
+ latencyMs: int
198
+
199
+ class GuardrailConfigurationTypeDef(TypedDict):
200
+ guardrailIdentifier: str
201
+ guardrailVersion: str
202
+ trace: NotRequired[GuardrailTraceType]
203
+
204
+ class InferenceConfigurationTypeDef(TypedDict):
205
+ maxTokens: NotRequired[int]
206
+ temperature: NotRequired[float]
207
+ topP: NotRequired[float]
208
+ stopSequences: NotRequired[Sequence[str]]
209
+
210
+ class PromptVariableValuesTypeDef(TypedDict):
211
+ text: NotRequired[str]
212
+
213
+ class TokenUsageTypeDef(TypedDict):
214
+ inputTokens: int
215
+ outputTokens: int
216
+ totalTokens: int
217
+
218
+ class ConverseStreamMetricsTypeDef(TypedDict):
219
+ latencyMs: int
220
+
221
+ class InternalServerExceptionTypeDef(TypedDict):
222
+ message: NotRequired[str]
223
+
224
+ class MessageStartEventTypeDef(TypedDict):
225
+ role: ConversationRoleType
226
+
227
+ class MessageStopEventTypeDef(TypedDict):
228
+ stopReason: StopReasonType
229
+ additionalModelResponseFields: NotRequired[Dict[str, Any]]
230
+
231
+ class ModelStreamErrorExceptionTypeDef(TypedDict):
232
+ message: NotRequired[str]
233
+ originalStatusCode: NotRequired[int]
234
+ originalMessage: NotRequired[str]
235
+
236
+ class ServiceUnavailableExceptionTypeDef(TypedDict):
237
+ message: NotRequired[str]
238
+
239
+ class ThrottlingExceptionTypeDef(TypedDict):
240
+ message: NotRequired[str]
241
+
242
+ class ValidationExceptionTypeDef(TypedDict):
243
+ message: NotRequired[str]
244
+
245
+ class GuardrailStreamConfigurationTypeDef(TypedDict):
246
+ guardrailIdentifier: str
247
+ guardrailVersion: str
248
+ trace: NotRequired[GuardrailTraceType]
249
+ streamProcessingMode: NotRequired[GuardrailStreamProcessingModeType]
250
+
251
+ DocumentSourceOutputTypeDef = TypedDict(
252
+ "DocumentSourceOutputTypeDef",
253
+ {
254
+ "bytes": NotRequired[bytes],
255
+ },
256
+ )
257
+
258
+ class GuardrailTextBlockTypeDef(TypedDict):
259
+ text: str
260
+ qualifiers: NotRequired[Sequence[GuardrailContentQualifierType]]
261
+
262
+ GuardrailContentFilterTypeDef = TypedDict(
263
+ "GuardrailContentFilterTypeDef",
264
+ {
265
+ "type": GuardrailContentFilterTypeType,
266
+ "confidence": GuardrailContentFilterConfidenceType,
267
+ "action": Literal["BLOCKED"],
268
+ "filterStrength": NotRequired[GuardrailContentFilterStrengthType],
269
+ },
270
+ )
271
+ GuardrailContextualGroundingFilterTypeDef = TypedDict(
272
+ "GuardrailContextualGroundingFilterTypeDef",
273
+ {
274
+ "type": GuardrailContextualGroundingFilterTypeType,
275
+ "threshold": float,
276
+ "score": float,
277
+ "action": GuardrailContextualGroundingPolicyActionType,
278
+ },
279
+ )
280
+
281
+ class GuardrailConverseTextBlockOutputTypeDef(TypedDict):
282
+ text: str
283
+ qualifiers: NotRequired[List[GuardrailConverseContentQualifierType]]
284
+
285
+ class GuardrailConverseTextBlockTypeDef(TypedDict):
286
+ text: str
287
+ qualifiers: NotRequired[Sequence[GuardrailConverseContentQualifierType]]
288
+
289
+ class GuardrailTextCharactersCoverageTypeDef(TypedDict):
290
+ guarded: NotRequired[int]
291
+ total: NotRequired[int]
292
+
293
+ class GuardrailCustomWordTypeDef(TypedDict):
294
+ match: str
295
+ action: Literal["BLOCKED"]
296
+
297
+ GuardrailManagedWordTypeDef = TypedDict(
298
+ "GuardrailManagedWordTypeDef",
299
+ {
300
+ "match": str,
301
+ "type": Literal["PROFANITY"],
302
+ "action": Literal["BLOCKED"],
303
+ },
304
+ )
305
+ GuardrailPiiEntityFilterTypeDef = TypedDict(
306
+ "GuardrailPiiEntityFilterTypeDef",
307
+ {
308
+ "match": str,
309
+ "type": GuardrailPiiEntityTypeType,
310
+ "action": GuardrailSensitiveInformationPolicyActionType,
311
+ },
312
+ )
313
+
314
+ class GuardrailRegexFilterTypeDef(TypedDict):
315
+ action: GuardrailSensitiveInformationPolicyActionType
316
+ name: NotRequired[str]
317
+ match: NotRequired[str]
318
+ regex: NotRequired[str]
319
+
320
+ GuardrailTopicTypeDef = TypedDict(
321
+ "GuardrailTopicTypeDef",
322
+ {
323
+ "name": str,
324
+ "type": Literal["DENY"],
325
+ "action": Literal["BLOCKED"],
326
+ },
327
+ )
328
+ ImageSourceOutputTypeDef = TypedDict(
329
+ "ImageSourceOutputTypeDef",
330
+ {
331
+ "bytes": NotRequired[bytes],
332
+ },
333
+ )
334
+
335
+ class ModelTimeoutExceptionTypeDef(TypedDict):
336
+ message: NotRequired[str]
337
+
338
+ PayloadPartTypeDef = TypedDict(
339
+ "PayloadPartTypeDef",
340
+ {
341
+ "bytes": NotRequired[bytes],
342
+ },
343
+ )
344
+
345
+ class SpecificToolChoiceTypeDef(TypedDict):
346
+ name: str
347
+
348
+ class ToolInputSchemaTypeDef(TypedDict):
349
+ json: NotRequired[Mapping[str, Any]]
350
+
351
+ ToolUseBlockTypeDef = TypedDict(
352
+ "ToolUseBlockTypeDef",
353
+ {
354
+ "toolUseId": str,
355
+ "name": str,
356
+ "input": Mapping[str, Any],
357
+ },
358
+ )
359
+
360
+ class InvokeModelResponseTypeDef(TypedDict):
361
+ body: StreamingBody
362
+ contentType: str
363
+ ResponseMetadata: ResponseMetadataTypeDef
364
+
365
+ DocumentSourceTypeDef = TypedDict(
366
+ "DocumentSourceTypeDef",
367
+ {
368
+ "bytes": NotRequired[BlobTypeDef],
369
+ },
370
+ )
371
+ ImageSourceTypeDef = TypedDict(
372
+ "ImageSourceTypeDef",
373
+ {
374
+ "bytes": NotRequired[BlobTypeDef],
375
+ },
376
+ )
377
+
378
+ class InvokeModelRequestRequestTypeDef(TypedDict):
379
+ modelId: str
380
+ body: NotRequired[BlobTypeDef]
381
+ contentType: NotRequired[str]
382
+ accept: NotRequired[str]
383
+ trace: NotRequired[TraceType]
384
+ guardrailIdentifier: NotRequired[str]
385
+ guardrailVersion: NotRequired[str]
386
+
387
+ class InvokeModelWithResponseStreamRequestRequestTypeDef(TypedDict):
388
+ modelId: str
389
+ body: NotRequired[BlobTypeDef]
390
+ contentType: NotRequired[str]
391
+ accept: NotRequired[str]
392
+ trace: NotRequired[TraceType]
393
+ guardrailIdentifier: NotRequired[str]
394
+ guardrailVersion: NotRequired[str]
395
+
396
+ class ContentBlockDeltaTypeDef(TypedDict):
397
+ text: NotRequired[str]
398
+ toolUse: NotRequired[ToolUseBlockDeltaTypeDef]
399
+
400
+ class ContentBlockStartTypeDef(TypedDict):
401
+ toolUse: NotRequired[ToolUseBlockStartTypeDef]
402
+
403
+ DocumentBlockOutputTypeDef = TypedDict(
404
+ "DocumentBlockOutputTypeDef",
405
+ {
406
+ "format": DocumentFormatType,
407
+ "name": str,
408
+ "source": DocumentSourceOutputTypeDef,
409
+ },
410
+ )
411
+
412
+ class GuardrailContentBlockTypeDef(TypedDict):
413
+ text: NotRequired[GuardrailTextBlockTypeDef]
414
+
415
+ class GuardrailContentPolicyAssessmentTypeDef(TypedDict):
416
+ filters: List[GuardrailContentFilterTypeDef]
417
+
418
+ class GuardrailContextualGroundingPolicyAssessmentTypeDef(TypedDict):
419
+ filters: NotRequired[List[GuardrailContextualGroundingFilterTypeDef]]
420
+
421
+ class GuardrailConverseContentBlockOutputTypeDef(TypedDict):
422
+ text: NotRequired[GuardrailConverseTextBlockOutputTypeDef]
423
+
424
+ GuardrailConverseTextBlockUnionTypeDef = Union[
425
+ GuardrailConverseTextBlockTypeDef, GuardrailConverseTextBlockOutputTypeDef
426
+ ]
427
+
428
+ class GuardrailCoverageTypeDef(TypedDict):
429
+ textCharacters: NotRequired[GuardrailTextCharactersCoverageTypeDef]
430
+
431
+ class GuardrailWordPolicyAssessmentTypeDef(TypedDict):
432
+ customWords: List[GuardrailCustomWordTypeDef]
433
+ managedWordLists: List[GuardrailManagedWordTypeDef]
434
+
435
+ class GuardrailSensitiveInformationPolicyAssessmentTypeDef(TypedDict):
436
+ piiEntities: List[GuardrailPiiEntityFilterTypeDef]
437
+ regexes: List[GuardrailRegexFilterTypeDef]
438
+
439
+ class GuardrailTopicPolicyAssessmentTypeDef(TypedDict):
440
+ topics: List[GuardrailTopicTypeDef]
441
+
442
+ ImageBlockOutputTypeDef = TypedDict(
443
+ "ImageBlockOutputTypeDef",
444
+ {
445
+ "format": ImageFormatType,
446
+ "source": ImageSourceOutputTypeDef,
447
+ },
448
+ )
449
+
450
+ class ResponseStreamTypeDef(TypedDict):
451
+ chunk: NotRequired[PayloadPartTypeDef]
452
+ internalServerException: NotRequired[InternalServerExceptionTypeDef]
453
+ modelStreamErrorException: NotRequired[ModelStreamErrorExceptionTypeDef]
454
+ validationException: NotRequired[ValidationExceptionTypeDef]
455
+ throttlingException: NotRequired[ThrottlingExceptionTypeDef]
456
+ modelTimeoutException: NotRequired[ModelTimeoutExceptionTypeDef]
457
+ serviceUnavailableException: NotRequired[ServiceUnavailableExceptionTypeDef]
458
+
459
+ ToolChoiceTypeDef = TypedDict(
460
+ "ToolChoiceTypeDef",
461
+ {
462
+ "auto": NotRequired[Mapping[str, Any]],
463
+ "any": NotRequired[Mapping[str, Any]],
464
+ "tool": NotRequired[SpecificToolChoiceTypeDef],
465
+ },
466
+ )
467
+
468
+ class ToolSpecificationTypeDef(TypedDict):
469
+ name: str
470
+ inputSchema: ToolInputSchemaTypeDef
471
+ description: NotRequired[str]
472
+
473
+ ToolUseBlockUnionTypeDef = Union[ToolUseBlockTypeDef, ToolUseBlockOutputTypeDef]
474
+ DocumentSourceUnionTypeDef = Union[DocumentSourceTypeDef, DocumentSourceOutputTypeDef]
475
+ ImageSourceUnionTypeDef = Union[ImageSourceTypeDef, ImageSourceOutputTypeDef]
476
+
477
+ class ContentBlockDeltaEventTypeDef(TypedDict):
478
+ delta: ContentBlockDeltaTypeDef
479
+ contentBlockIndex: int
480
+
481
+ class ContentBlockStartEventTypeDef(TypedDict):
482
+ start: ContentBlockStartTypeDef
483
+ contentBlockIndex: int
484
+
485
+ class ApplyGuardrailRequestRequestTypeDef(TypedDict):
486
+ guardrailIdentifier: str
487
+ guardrailVersion: str
488
+ source: GuardrailContentSourceType
489
+ content: Sequence[GuardrailContentBlockTypeDef]
490
+
491
+ class GuardrailConverseContentBlockTypeDef(TypedDict):
492
+ text: NotRequired[GuardrailConverseTextBlockUnionTypeDef]
493
+
494
+ class GuardrailInvocationMetricsTypeDef(TypedDict):
495
+ guardrailProcessingLatency: NotRequired[int]
496
+ usage: NotRequired[GuardrailUsageTypeDef]
497
+ guardrailCoverage: NotRequired[GuardrailCoverageTypeDef]
498
+
499
+ class ToolResultContentBlockOutputTypeDef(TypedDict):
500
+ json: NotRequired[Dict[str, Any]]
501
+ text: NotRequired[str]
502
+ image: NotRequired[ImageBlockOutputTypeDef]
503
+ document: NotRequired[DocumentBlockOutputTypeDef]
504
+
505
+ class InvokeModelWithResponseStreamResponseTypeDef(TypedDict):
506
+ body: "EventStream[ResponseStreamTypeDef]"
507
+ contentType: str
508
+ ResponseMetadata: ResponseMetadataTypeDef
509
+
510
+ class ToolTypeDef(TypedDict):
511
+ toolSpec: NotRequired[ToolSpecificationTypeDef]
512
+
513
+ DocumentBlockTypeDef = TypedDict(
514
+ "DocumentBlockTypeDef",
515
+ {
516
+ "format": DocumentFormatType,
517
+ "name": str,
518
+ "source": DocumentSourceUnionTypeDef,
519
+ },
520
+ )
521
+ ImageBlockTypeDef = TypedDict(
522
+ "ImageBlockTypeDef",
523
+ {
524
+ "format": ImageFormatType,
525
+ "source": ImageSourceUnionTypeDef,
526
+ },
527
+ )
528
+ GuardrailConverseContentBlockUnionTypeDef = Union[
529
+ GuardrailConverseContentBlockTypeDef, GuardrailConverseContentBlockOutputTypeDef
530
+ ]
531
+
532
+ class GuardrailAssessmentTypeDef(TypedDict):
533
+ topicPolicy: NotRequired[GuardrailTopicPolicyAssessmentTypeDef]
534
+ contentPolicy: NotRequired[GuardrailContentPolicyAssessmentTypeDef]
535
+ wordPolicy: NotRequired[GuardrailWordPolicyAssessmentTypeDef]
536
+ sensitiveInformationPolicy: NotRequired[GuardrailSensitiveInformationPolicyAssessmentTypeDef]
537
+ contextualGroundingPolicy: NotRequired[GuardrailContextualGroundingPolicyAssessmentTypeDef]
538
+ invocationMetrics: NotRequired[GuardrailInvocationMetricsTypeDef]
539
+
540
+ class ToolResultBlockOutputTypeDef(TypedDict):
541
+ toolUseId: str
542
+ content: List[ToolResultContentBlockOutputTypeDef]
543
+ status: NotRequired[ToolResultStatusType]
544
+
545
+ class ToolConfigurationTypeDef(TypedDict):
546
+ tools: Sequence[ToolTypeDef]
547
+ toolChoice: NotRequired[ToolChoiceTypeDef]
548
+
549
+ DocumentBlockUnionTypeDef = Union[DocumentBlockTypeDef, DocumentBlockOutputTypeDef]
550
+ ImageBlockUnionTypeDef = Union[ImageBlockTypeDef, ImageBlockOutputTypeDef]
551
+
552
+ class SystemContentBlockTypeDef(TypedDict):
553
+ text: NotRequired[str]
554
+ guardContent: NotRequired[GuardrailConverseContentBlockUnionTypeDef]
555
+
556
+ class ApplyGuardrailResponseTypeDef(TypedDict):
557
+ usage: GuardrailUsageTypeDef
558
+ action: GuardrailActionType
559
+ outputs: List[GuardrailOutputContentTypeDef]
560
+ assessments: List[GuardrailAssessmentTypeDef]
561
+ guardrailCoverage: GuardrailCoverageTypeDef
562
+ ResponseMetadata: ResponseMetadataTypeDef
563
+
564
+ class GuardrailTraceAssessmentTypeDef(TypedDict):
565
+ modelOutput: NotRequired[List[str]]
566
+ inputAssessment: NotRequired[Dict[str, GuardrailAssessmentTypeDef]]
567
+ outputAssessments: NotRequired[Dict[str, List[GuardrailAssessmentTypeDef]]]
568
+
569
+ class ContentBlockOutputTypeDef(TypedDict):
570
+ text: NotRequired[str]
571
+ image: NotRequired[ImageBlockOutputTypeDef]
572
+ document: NotRequired[DocumentBlockOutputTypeDef]
573
+ toolUse: NotRequired[ToolUseBlockOutputTypeDef]
574
+ toolResult: NotRequired[ToolResultBlockOutputTypeDef]
575
+ guardContent: NotRequired[GuardrailConverseContentBlockOutputTypeDef]
576
+
577
+ class ToolResultContentBlockTypeDef(TypedDict):
578
+ json: NotRequired[Mapping[str, Any]]
579
+ text: NotRequired[str]
580
+ image: NotRequired[ImageBlockUnionTypeDef]
581
+ document: NotRequired[DocumentBlockUnionTypeDef]
582
+
583
+ class ConverseStreamTraceTypeDef(TypedDict):
584
+ guardrail: NotRequired[GuardrailTraceAssessmentTypeDef]
585
+
586
+ class ConverseTraceTypeDef(TypedDict):
587
+ guardrail: NotRequired[GuardrailTraceAssessmentTypeDef]
588
+
589
+ class MessageOutputTypeDef(TypedDict):
590
+ role: ConversationRoleType
591
+ content: List[ContentBlockOutputTypeDef]
592
+
593
+ ToolResultContentBlockUnionTypeDef = Union[
594
+ ToolResultContentBlockTypeDef, ToolResultContentBlockOutputTypeDef
595
+ ]
596
+
597
+ class ConverseStreamMetadataEventTypeDef(TypedDict):
598
+ usage: TokenUsageTypeDef
599
+ metrics: ConverseStreamMetricsTypeDef
600
+ trace: NotRequired[ConverseStreamTraceTypeDef]
601
+
602
+ class ConverseOutputTypeDef(TypedDict):
603
+ message: NotRequired[MessageOutputTypeDef]
604
+
605
+ class ToolResultBlockTypeDef(TypedDict):
606
+ toolUseId: str
607
+ content: Sequence[ToolResultContentBlockUnionTypeDef]
608
+ status: NotRequired[ToolResultStatusType]
609
+
610
+ class ConverseStreamOutputTypeDef(TypedDict):
611
+ messageStart: NotRequired[MessageStartEventTypeDef]
612
+ contentBlockStart: NotRequired[ContentBlockStartEventTypeDef]
613
+ contentBlockDelta: NotRequired[ContentBlockDeltaEventTypeDef]
614
+ contentBlockStop: NotRequired[ContentBlockStopEventTypeDef]
615
+ messageStop: NotRequired[MessageStopEventTypeDef]
616
+ metadata: NotRequired[ConverseStreamMetadataEventTypeDef]
617
+ internalServerException: NotRequired[InternalServerExceptionTypeDef]
618
+ modelStreamErrorException: NotRequired[ModelStreamErrorExceptionTypeDef]
619
+ validationException: NotRequired[ValidationExceptionTypeDef]
620
+ throttlingException: NotRequired[ThrottlingExceptionTypeDef]
621
+ serviceUnavailableException: NotRequired[ServiceUnavailableExceptionTypeDef]
622
+
623
+ class ConverseResponseTypeDef(TypedDict):
624
+ output: ConverseOutputTypeDef
625
+ stopReason: StopReasonType
626
+ usage: TokenUsageTypeDef
627
+ metrics: ConverseMetricsTypeDef
628
+ additionalModelResponseFields: Dict[str, Any]
629
+ trace: ConverseTraceTypeDef
630
+ ResponseMetadata: ResponseMetadataTypeDef
631
+
632
+ ToolResultBlockUnionTypeDef = Union[ToolResultBlockTypeDef, ToolResultBlockOutputTypeDef]
633
+
634
+ class ConverseStreamResponseTypeDef(TypedDict):
635
+ stream: "EventStream[ConverseStreamOutputTypeDef]"
636
+ ResponseMetadata: ResponseMetadataTypeDef
637
+
638
+ class ContentBlockTypeDef(TypedDict):
639
+ text: NotRequired[str]
640
+ image: NotRequired[ImageBlockUnionTypeDef]
641
+ document: NotRequired[DocumentBlockUnionTypeDef]
642
+ toolUse: NotRequired[ToolUseBlockUnionTypeDef]
643
+ toolResult: NotRequired[ToolResultBlockUnionTypeDef]
644
+ guardContent: NotRequired[GuardrailConverseContentBlockUnionTypeDef]
645
+
646
+ ContentBlockUnionTypeDef = Union[ContentBlockTypeDef, ContentBlockOutputTypeDef]
647
+
648
+ class MessageTypeDef(TypedDict):
649
+ role: ConversationRoleType
650
+ content: Sequence[ContentBlockUnionTypeDef]
651
+
652
+ class ConverseStreamRequestRequestTypeDef(TypedDict):
653
+ modelId: str
654
+ messages: NotRequired[Sequence[MessageTypeDef]]
655
+ system: NotRequired[Sequence[SystemContentBlockTypeDef]]
656
+ inferenceConfig: NotRequired[InferenceConfigurationTypeDef]
657
+ toolConfig: NotRequired[ToolConfigurationTypeDef]
658
+ guardrailConfig: NotRequired[GuardrailStreamConfigurationTypeDef]
659
+ additionalModelRequestFields: NotRequired[Mapping[str, Any]]
660
+ promptVariables: NotRequired[Mapping[str, PromptVariableValuesTypeDef]]
661
+ additionalModelResponseFieldPaths: NotRequired[Sequence[str]]
662
+
663
+ MessageUnionTypeDef = Union[MessageTypeDef, MessageOutputTypeDef]
664
+
665
+ class ConverseRequestRequestTypeDef(TypedDict):
666
+ modelId: str
667
+ messages: NotRequired[Sequence[MessageUnionTypeDef]]
668
+ system: NotRequired[Sequence[SystemContentBlockTypeDef]]
669
+ inferenceConfig: NotRequired[InferenceConfigurationTypeDef]
670
+ toolConfig: NotRequired[ToolConfigurationTypeDef]
671
+ guardrailConfig: NotRequired[GuardrailConfigurationTypeDef]
672
+ additionalModelRequestFields: NotRequired[Mapping[str, Any]]
673
+ promptVariables: NotRequired[Mapping[str, PromptVariableValuesTypeDef]]
674
+ additionalModelResponseFieldPaths: NotRequired[Sequence[str]]
@@ -0,0 +1,7 @@
1
+ """
2
+ Source of truth for version.
3
+
4
+ Copyright 2024 Vlad Emelianov
5
+ """
6
+
7
+ __version__ = "1.35.71"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Vlad Emelianov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.