Skip to content

Media

datapizza.type.Media

A class for storing the media response from a client.

__init__

__init__(
    *,
    extension=None,
    media_type,
    source_type,
    source,
    detail="high",
)

A class for storing the media response from a client.

Parameters:

Name Type Description Default
extension str

The file extension of the media. Defaults to None.

None
media_type Literal['image', 'video', 'audio', 'pdf']

The type of media. Defaults to "image".

required
source_type Literal['url', 'base64', 'path', 'pil', 'raw']

The source type of the media. Defaults to "url".

required
source Any

The source of the media. Defaults to None.

required

to_dict

to_dict()

Convert the media to a dictionary for JSON serialization.