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
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.
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.
_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.
use_media_request_budgets(budgets)
¶
Share byte budgets among trackers created in one request.