pub struct MtmdInputChunk<'chunks> { /* private fields */ }Expand description
A single tokenized input chunk (text, image, or audio).
Instances are borrowed from an MtmdInputChunks list and live as long
as that list.
Implementations§
Source§impl<'chunks> MtmdInputChunk<'chunks>
impl<'chunks> MtmdInputChunk<'chunks>
Sourcepub fn chunk_type(&self) -> MtmdInputChunkType
pub fn chunk_type(&self) -> MtmdInputChunkType
The type of this chunk.
Sourcepub fn n_pos(&self) -> i32
pub fn n_pos(&self) -> i32
Number of temporal positions (equals n_tokens for non-M-RoPE models).
Sourcepub fn text_tokens(&self) -> Option<&[i32]>
pub fn text_tokens(&self) -> Option<&[i32]>
Return the raw llama token IDs for a text chunk.
Returns None if this chunk is not a text chunk.
Sourcepub fn image_tokens(&self) -> Option<MtmdImageTokens<'chunks>>
pub fn image_tokens(&self) -> Option<MtmdImageTokens<'chunks>>
Return the image token metadata for an image or audio chunk.
Returns None for text chunks.
Sourcepub fn id(&self) -> Option<&str>
pub fn id(&self) -> Option<&str>
Optional ID attached to this chunk (used for KV cache tracking).
Sourcepub fn as_ptr(&self) -> *const mtmd_input_chunk
pub fn as_ptr(&self) -> *const mtmd_input_chunk
Returns the raw *const mtmd_input_chunk pointer.
§Safety
The returned pointer is valid for the lifetime of the parent
MtmdInputChunks.
Trait Implementations§
Auto Trait Implementations§
impl<'chunks> Freeze for MtmdInputChunk<'chunks>
impl<'chunks> RefUnwindSafe for MtmdInputChunk<'chunks>
impl<'chunks> !Send for MtmdInputChunk<'chunks>
impl<'chunks> !Sync for MtmdInputChunk<'chunks>
impl<'chunks> Unpin for MtmdInputChunk<'chunks>
impl<'chunks> UnsafeUnpin for MtmdInputChunk<'chunks>
impl<'chunks> UnwindSafe for MtmdInputChunk<'chunks>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more