Media
Media model.
This module defines the Media model for handling metadata related to media elements.
Elements containing media tags (e.g., image, audio, video, or youtube) will have a media
metadata field.
This field is a list of dictionaries, where each dictionary adheres to the Media model schema.
Media
Bases: BaseModel
Media model which contains media information.
This class serves as the base model for storing media information in element metadata.
Element with media (image, audio, video, youtube) will have metadata media
in list of dict.
Each dict will be following the Media model schema.
Attributes:
Name | Type | Description |
---|---|---|
media_id |
str
|
Unique identifier for the media, automatically generated from media_type and media_content. |
media_type |
MediaType
|
Type of media (image, audio, video, youtube). |
media_content |
str
|
Base64 encoded string or URL pointing to the media content. |
media_content_type |
MediaSourceType
|
Type of content source (base64 or url). |
media_id: str
property
Generate a standardized media ID.
This property generates a standardized media ID in the format: {media_type}_{sha256_from_media_content_16_digit}
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The generated media ID. |
Config
Pydantic model configuration.
This class defines the Pydantic model configuration for the Media model.
Attributes:
Name | Type | Description |
---|---|---|
extra |
str
|
Allow extra fields. |
MediaSourceType
Bases: StrEnum
Defines valid media source types.
MediaType
Bases: StrEnum
Defines valid media types.