#[non_exhaustive]pub struct DocumentSource {
pub title: Option<String>,
pub author: Option<String>,
pub creation_date: Option<String>,
pub filename: Option<String>,
pub doc_hash: Option<String>,
pub total_pages: Option<u32>,
}Expand description
Metadata about the source document a chunk came from.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.title: Option<String>Document title from the info dictionary, if present.
Document author from the info dictionary, if present.
creation_date: Option<String>Creation date string from the info dictionary, if present.
filename: Option<String>Originating file name (caller-supplied — the pipeline does not know it).
doc_hash: Option<String>Stable document hash (caller-supplied; used as the chunk_id prefix).
total_pages: Option<u32>Total page count of the source document.
Implementations§
Source§impl DocumentSource
impl DocumentSource
Sourcepub fn with_file(filename: Option<String>, doc_hash: Option<String>) -> Self
pub fn with_file(filename: Option<String>, doc_hash: Option<String>) -> Self
Construct a source from the two caller-supplied fields (filename,
doc_hash); the rest (title/author/creation_date/total_pages)
are left None for rag_chunks_with_source
to auto-fill from the info dictionary. Provided because DocumentSource
is #[non_exhaustive], so external callers cannot use a struct literal.
Trait Implementations§
Source§impl Clone for DocumentSource
impl Clone for DocumentSource
Source§fn clone(&self) -> DocumentSource
fn clone(&self) -> DocumentSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DocumentSource
impl Debug for DocumentSource
Source§impl Default for DocumentSource
impl Default for DocumentSource
Source§fn default() -> DocumentSource
fn default() -> DocumentSource
Returns the “default value” for a type. Read more
impl Eq for DocumentSource
Source§impl PartialEq for DocumentSource
impl PartialEq for DocumentSource
Source§fn eq(&self, other: &DocumentSource) -> bool
fn eq(&self, other: &DocumentSource) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DocumentSource
Auto Trait Implementations§
impl Freeze for DocumentSource
impl RefUnwindSafe for DocumentSource
impl Send for DocumentSource
impl Sync for DocumentSource
impl Unpin for DocumentSource
impl UnsafeUnpin for DocumentSource
impl UnwindSafe for DocumentSource
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