vllm.multimodal.media.base ¶
Classes:
-
MediaIO–Configuration values can be user-provided either by --media-io-kwargs or
-
MediaWithBytes–Wrapper that couples a media object with its original encoded bytes.
MediaIO ¶
Configuration values can be user-provided either by --media-io-kwargs or by the runtime API field "media_io_kwargs". Ensure proper validation and error handling.
Methods:
-
load_base64–List of media types:
-
merge_kwargs–Merge config-level kwargs and request-level kwargs.
Source code in vllm/multimodal/media/base.py
load_base64(media_type, data) abstractmethod ¶
List of media types: https://www.iana.org/assignments/media-types/media-types.xhtml
merge_kwargs(default_kwargs, runtime_kwargs) classmethod ¶
Merge config-level kwargs and request-level kwargs.
By default this performs a shallow merge where runtime kwargs override keys in default kwargs. Subclasses may override to apply modality- specific behavior.
Source code in vllm/multimodal/media/base.py
MediaWithBytes dataclass ¶
Bases: Generic[_T]
Wrapper that couples a media object with its original encoded bytes.
This ensures the raw bytes and media object remain synchronized, preventing cache corruption from in-place modifications.
The wrapper delegates attribute access to the underlying media object, making it behave transparently like the wrapped type (e.g., PIL.Image).
NOTE: Currently, this wrapper is used only for the image modality.
Methods:
-
__array__–Allow np.array(obj) to return np.array(obj.media).
-
__getattr__–Delegate attribute access to the underlying media object.