strands.types.media
¶
Media-related type definitions for the SDK.
These types are modeled after the Bedrock API.
- Bedrock docs: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_Types_Amazon_Bedrock_Runtime.html
DocumentFormat = Literal['pdf', 'csv', 'doc', 'docx', 'xls', 'xlsx', 'html', 'txt', 'md']
module-attribute
¶
Supported document formats.
ImageFormat = Literal['png', 'jpeg', 'gif', 'webp']
module-attribute
¶
Supported image formats.
SourceLocation = Location | S3Location
module-attribute
¶
VideoFormat = Literal['flv', 'mkv', 'mov', 'mpeg', 'mpg', 'mp4', 'three_gp', 'webm', 'wmv']
module-attribute
¶
Supported video formats.
CitationsConfig
¶
Bases: TypedDict
Configuration for enabling citations on documents.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
Whether citations are enabled for this document. |
Source code in strands/types/citations.py
11 12 13 14 15 16 17 18 | |
DocumentContent
¶
Bases: TypedDict
A document to include in a message.
Attributes:
| Name | Type | Description |
|---|---|---|
format |
Literal['pdf', 'csv', 'doc', 'docx', 'xls', 'xlsx', 'html', 'txt', 'md']
|
The format of the document (e.g., "pdf", "txt"). |
name |
str
|
The name of the document. |
source |
DocumentSource
|
The source containing the document's binary content. |
Source code in strands/types/media.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
DocumentSource
¶
Bases: TypedDict
Contains the content of a document.
Only one of bytes or s3Location should be specified.
Attributes:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
The binary content of the document. |
location |
SourceLocation
|
Location of the document. |
Source code in strands/types/media.py
50 51 52 53 54 55 56 57 58 59 60 61 | |
ImageContent
¶
Bases: TypedDict
An image to include in a message.
Attributes:
| Name | Type | Description |
|---|---|---|
format |
ImageFormat
|
The format of the image (e.g., "png", "jpeg"). |
source |
ImageSource
|
The source containing the image's binary content. |
Source code in strands/types/media.py
98 99 100 101 102 103 104 105 106 107 | |
ImageSource
¶
Bases: TypedDict
Contains the content of an image.
Only one of bytes or s3Location should be specified.
Attributes:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
The binary content of the image. |
location |
SourceLocation
|
Location of the image. |
Source code in strands/types/media.py
84 85 86 87 88 89 90 91 92 93 94 95 | |
Location
¶
Bases: TypedDict
A location for a document.
This type is a generic location for a document. Its usage is determined by the underlying model provider.
Source code in strands/types/media.py
18 19 20 21 22 23 24 | |
S3Location
¶
Bases: Location
A storage location in an Amazon S3 bucket.
Used by Bedrock to reference media files stored in S3 instead of passing raw bytes.
- Docs: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_S3Location.html
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['s3']
|
s3 |
uri |
Required[str]
|
An object URI starting with |
bucketOwner |
str
|
If the bucket belongs to another AWS account, specify that account's ID. Optional. |
Source code in strands/types/media.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
VideoContent
¶
Bases: TypedDict
A video to include in a message.
Attributes:
| Name | Type | Description |
|---|---|---|
format |
VideoFormat
|
The format of the video (e.g., "mp4", "avi"). |
source |
VideoSource
|
The source containing the video's binary content. |
Source code in strands/types/media.py
128 129 130 131 132 133 134 135 136 137 | |
VideoSource
¶
Bases: TypedDict
Contains the content of a video.
Only one of bytes or s3Location should be specified.
Attributes:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
The binary content of the video. |
location |
SourceLocation
|
Location of the video. |
Source code in strands/types/media.py
114 115 116 117 118 119 120 121 122 123 124 125 | |