Skip to content

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.

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
class CitationsConfig(TypedDict):
    """Configuration for enabling citations on documents.

    Attributes:
        enabled: Whether citations are enabled for this document.
    """

    enabled: bool

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class DocumentContent(TypedDict, total=False):
    """A document to include in a message.

    Attributes:
        format: The format of the document (e.g., "pdf", "txt").
        name: The name of the document.
        source: The source containing the document's binary content.
    """

    format: Literal["pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md"]
    name: str
    source: DocumentSource
    citations: Optional[CitationsConfig]
    context: Optional[str]

DocumentSource

Bases: TypedDict

Contains the content of a document.

Attributes:

Name Type Description
bytes bytes

The binary content of the document.

Source code in strands/types/media.py
18
19
20
21
22
23
24
25
class DocumentSource(TypedDict):
    """Contains the content of a document.

    Attributes:
        bytes: The binary content of the document.
    """

    bytes: bytes

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
58
59
60
61
62
63
64
65
66
67
class ImageContent(TypedDict):
    """An image to include in a message.

    Attributes:
        format: The format of the image (e.g., "png", "jpeg").
        source: The source containing the image's binary content.
    """

    format: ImageFormat
    source: ImageSource

ImageSource

Bases: TypedDict

Contains the content of an image.

Attributes:

Name Type Description
bytes bytes

The binary content of the image.

Source code in strands/types/media.py
48
49
50
51
52
53
54
55
class ImageSource(TypedDict):
    """Contains the content of an image.

    Attributes:
        bytes: The binary content of the image.
    """

    bytes: bytes

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
84
85
86
87
88
89
90
91
92
93
class VideoContent(TypedDict):
    """A video to include in a message.

    Attributes:
        format: The format of the video (e.g., "mp4", "avi").
        source: The source containing the video's binary content.
    """

    format: VideoFormat
    source: VideoSource

VideoSource

Bases: TypedDict

Contains the content of a video.

Attributes:

Name Type Description
bytes bytes

The binary content of the video.

Source code in strands/types/media.py
74
75
76
77
78
79
80
81
class VideoSource(TypedDict):
    """Contains the content of a video.

    Attributes:
        bytes: The binary content of the video.
    """

    bytes: bytes