pub struct MultimodalDocument {
pub id: String,
pub filename: String,
pub file_type: FileType,
pub file_size: usize,
pub extracted_text: String,
pub chunks: Vec<DocumentChunk>,
pub embedding: Vec<f32>,
pub timestamp: i64,
pub metadata: HashMap<String, String>,
}Expand description
Multimodal document with extracted content and embeddings
This structure supports AI/LLM memory systems by storing:
- Original file metadata and binary content
- Extracted text (from PDF/DOCX/audio transcription/video captions)
- Vector embeddings for semantic search
- Chunked content for large documents
§Use Cases
- Document question-answering with RAG (Retrieval Augmented Generation)
- Multimodal AI agent memory (text, audio, video, images)
- Semantic search across diverse content types
- Knowledge base construction from various file formats
Fields§
§id: StringUnique document identifier
filename: StringOriginal filename
file_type: FileTypeFile type
file_size: usizeOriginal file size in bytes
extracted_text: StringExtracted text content (from OCR, transcription, or direct extraction)
chunks: Vec<DocumentChunk>Document chunks for large files (optional)
For large documents, content is split into chunks with separate embeddings to enable efficient semantic search and retrieval
embedding: Vec<f32>Document-level embedding (summary embedding)
timestamp: i64Creation/ingestion timestamp
metadata: HashMap<String, String>Additional metadata (e.g., author, title, transcription model, etc.)
Implementations§
Source§impl MultimodalDocument
impl MultimodalDocument
Trait Implementations§
Source§impl Archive for MultimodalDocument
impl Archive for MultimodalDocument
Source§type Archived = ArchivedMultimodalDocument
type Archived = ArchivedMultimodalDocument
The archived representation of this type. Read more
Source§type Resolver = MultimodalDocumentResolver
type Resolver = MultimodalDocumentResolver
The resolver for this type. It must contain all the additional information from serializing
needed to make the archived type from the normal type.
Source§impl Clone for MultimodalDocument
impl Clone for MultimodalDocument
Source§impl Debug for MultimodalDocument
impl Debug for MultimodalDocument
Source§impl<'de> Deserialize<'de> for MultimodalDocument
impl<'de> Deserialize<'de> for MultimodalDocument
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<__D: Fallible + ?Sized> Deserialize<MultimodalDocument, __D> for Archived<MultimodalDocument>where
String: Archive,
Archived<String>: Deserialize<String, __D>,
FileType: Archive,
Archived<FileType>: Deserialize<FileType, __D>,
usize: Archive,
Archived<usize>: Deserialize<usize, __D>,
Vec<DocumentChunk>: Archive,
Archived<Vec<DocumentChunk>>: Deserialize<Vec<DocumentChunk>, __D>,
Vec<f32>: Archive,
Archived<Vec<f32>>: Deserialize<Vec<f32>, __D>,
i64: Archive,
Archived<i64>: Deserialize<i64, __D>,
HashMap<String, String>: Archive,
Archived<HashMap<String, String>>: Deserialize<HashMap<String, String>, __D>,
impl<__D: Fallible + ?Sized> Deserialize<MultimodalDocument, __D> for Archived<MultimodalDocument>where
String: Archive,
Archived<String>: Deserialize<String, __D>,
FileType: Archive,
Archived<FileType>: Deserialize<FileType, __D>,
usize: Archive,
Archived<usize>: Deserialize<usize, __D>,
Vec<DocumentChunk>: Archive,
Archived<Vec<DocumentChunk>>: Deserialize<Vec<DocumentChunk>, __D>,
Vec<f32>: Archive,
Archived<Vec<f32>>: Deserialize<Vec<f32>, __D>,
i64: Archive,
Archived<i64>: Deserialize<i64, __D>,
HashMap<String, String>: Archive,
Archived<HashMap<String, String>>: Deserialize<HashMap<String, String>, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<MultimodalDocument, __D::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<MultimodalDocument, __D::Error>
Deserializes using the given deserializer
Source§impl Serialize for MultimodalDocument
impl Serialize for MultimodalDocument
Auto Trait Implementations§
impl Freeze for MultimodalDocument
impl RefUnwindSafe for MultimodalDocument
impl Send for MultimodalDocument
impl Sync for MultimodalDocument
impl Unpin for MultimodalDocument
impl UnsafeUnpin for MultimodalDocument
impl UnwindSafe for MultimodalDocument
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike
Archive, it may be unsized. Read moreSource§type MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type. Read more
Source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
Creates the archived version of the metadata for this value at the given position and writes
it to the given output. Read more
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.