pub struct Chunk {
pub text: String,
pub heading_path: Vec<String>,
pub source: Option<String>,
pub byte_range: (usize, usize),
pub hash: String,
}Expand description
One RAG chunk.
The field names are the public JSON schema (docs/PRD/02-cli-spec.md).
source repeats the document path on purpose: chunks are usually flattened
into a vector store one by one, and a chunk that cannot say where it came
from is a citation you cannot follow back.
Fields§
§text: String§heading_path: Vec<String>Enclosing headings, outermost first (["Introduction", "Method"]).
source: Option<String>Path the document was read from, when it is known.
byte_range: (usize, usize)Byte range of the chunk inside the rendered Markdown.
hash: StringContent hash, "sha256:<hex>" — see chunk_hash.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chunk
impl<'de> Deserialize<'de> for Chunk
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
impl StructuralPartialEq for Chunk
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnsafeUnpin for Chunk
impl UnwindSafe for Chunk
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