Media
media ¶
Multimodal adapters for media handling.
Currently contains VideoBlobService for video file loading and validation.
Anticipated growth: image processing adapters, audio adapters, multi-format media services.
| ATTRIBUTE | DESCRIPTION |
|---|---|
VideoBlobService | Implementation of VideoBlobServiceProtocol.
|
MAX_VIDEO_SIZE_BYTES | Maximum allowed video file size (2GB).
|
Examples:
Load a video file as a blob:
from gepa_adk.adapters.media import VideoBlobService
service = VideoBlobService()
blob = service.load(path="/path/to/video.mp4")
See Also
gepa_adk.adapters: Parent adapter layer re-exports.gepa_adk.ports.video_blob_service: VideoBlobServiceProtocol that VideoBlobService implements.
Note
This package provides multimodal media adapters for video blob services.
VideoBlobService ¶
Video blob loading service for multimodal content.
Implements VideoBlobServiceProtocol to convert video files to ADK Part objects. Validates video files for existence, size limits, and MIME types before loading.
| ATTRIBUTE | DESCRIPTION |
|---|---|
_logger | Structured logger for video operations. TYPE: |
Examples:
Load a single video:
service = VideoBlobService()
parts = await service.prepare_video_parts(["/data/lecture.mp4"])
assert len(parts) == 1
Load multiple videos:
paths = ["/data/intro.mp4", "/data/main.mp4"]
parts = await service.prepare_video_parts(paths)
assert len(parts) == 2
Handle validation errors:
from gepa_adk.domain.exceptions import VideoValidationError
try:
parts = await service.prepare_video_parts(["/missing.mp4"])
except VideoValidationError as e:
print(f"Invalid: {e.video_path}")
Note
Adapter implements VideoBlobServiceProtocol for dependency injection and testing. All ADK-specific Part creation is encapsulated here.
Source code in src/gepa_adk/adapters/media/video_blob_service.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
__init__ ¶
Initialize VideoBlobService.
Examples:
Default initialization:
Note
Creates a service instance with a bound logger for video operations. No external dependencies are required.
Source code in src/gepa_adk/adapters/media/video_blob_service.py
validate_video_file ¶
validate_video_file(video_path: str) -> VideoFileInfo
Validate a video file and return its metadata.
Checks that the file exists, is within size limits, and has a valid video MIME type.
| PARAMETER | DESCRIPTION |
|---|---|
video_path | Absolute path to the video file to validate. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
VideoFileInfo | VideoFileInfo containing validated metadata. |
| RAISES | DESCRIPTION |
|---|---|
VideoValidationError | If validation fails. |
Examples:
Validate a video file:
Note
Operates synchronously for fast pre-validation. File content is not read, only metadata is checked.
Source code in src/gepa_adk/adapters/media/video_blob_service.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
prepare_video_parts async ¶
Load video files and create Part objects for multimodal content.
Validates and loads all video files, converting them to ADK Part objects with inline video data.
| PARAMETER | DESCRIPTION |
|---|---|
video_paths | List of absolute paths to video files. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list[Part] | List of Part objects, one per input path. Order is preserved. |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If video_paths is empty. |
VideoValidationError | If any file fails validation. |
Examples:
Load videos:
parts = await service.prepare_video_parts(
[
"/data/intro.mp4",
"/data/main.mp4",
]
)
assert len(parts) == 2
Note
Operations include async file I/O. Videos are validated before loading to provide early failure with clear error messages.