vllm.renderers.chat_utils.item_tracker
¶
Classes:
-
BaseMultiModalItemTracker–Tracks multi-modal items in a given request and ensures that the number
Functions:
-
use_media_request_budgets–Share byte budgets among trackers created in one request.
BaseMultiModalItemTracker
¶
Tracks multi-modal items in a given request and ensures that the number of multi-modal items in a given request does not exceed the configured maximum per prompt.
Methods:
-
add–Add a multi-modal item to the current prompt and returns the
Attributes:
-
use_unified_vision_chunk_modality(bool) –Check if model uses unified vision_chunk modality for images/videos.
-
video_io_defaults(dict[str, Any]) –The HF video processor's frame caps, applied unless
media_io_kwargs
Source code in vllm/renderers/chat_utils/item_tracker.py
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 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
use_unified_vision_chunk_modality
cached
property
¶
Check if model uses unified vision_chunk modality for images/videos.
video_io_defaults
cached
property
¶
The HF video processor's frame caps, applied unless media_io_kwargs
overrides them. Read only when a request carries a video.
_validate_add(modality)
¶
Validate that one more item of the modality can be tracked.
Source code in vllm/renderers/chat_utils/item_tracker.py
add(modality, item)
¶
Add a multi-modal item to the current prompt and returns the placeholder string to use, if any.
An optional uuid can be added which serves as a unique identifier of the media.
Note
prompt_embeds bypass MM-processor validation because they are
pre-computed embeddings that do not go through any HF processor, encoder,
or model-specific placeholder logic. The corresponding placeholder string is
managed by the parser via _add_placeholder, so we return None here.
Source code in vllm/renderers/chat_utils/item_tracker.py
_resolve_items(items_by_modality, mm_processor, modality_order)
¶
Materialize the tracker's per-modality items into mm_data / mm_uuids.
Note
mm_processor is None for text-only models (no registered HF
processor) whose only modality is prompt_embeds. Every other
modality requires a processor, enforced by the guard below.
Source code in vllm/renderers/chat_utils/item_tracker.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
use_media_request_budgets(budgets)
¶
Share byte budgets among trackers created in one request.