pub struct Request { /* private fields */ }Expand description
Canonical Request used to derive a deterministic sequence of block hashes.
Construction validates mm_info (no overlap, no out-of-bounds, no zero-length) and
sorts it by offset. The validated/sorted state is the only way to construct a
Request, so all downstream block-formation code can trust the invariant.
Built via the owned RequestBuilder (no clones on the build path):
let request = Request::builder()
.tokens(tokens)
.lora_name(Some("lora-x".into()))
.salt(Some("model-tag".into()))
.mm_info(vec![/* RequestMmObjectInfo ... */])
.build()?;Implementations§
Source§impl Request
impl Request
Sourcepub fn salt_hash(&self) -> Result<SaltHash, KvHashingError>
pub fn salt_hash(&self) -> Result<SaltHash, KvHashingError>
Returns the canonical SaltHash for this request.
Sourcepub fn into_blocks(
&self,
block_size: u32,
) -> Result<Vec<UniversalBlock>, KvHashingError>
pub fn into_blocks( &self, block_size: u32, ) -> Result<Vec<UniversalBlock>, KvHashingError>
Returns the rich per-block result.
One UniversalBlock per complete block_size-sized window in the request’s
token stream (placeholder slots count toward block_size). A trailing partial
block — fewer than block_size slots — is not hashed and not returned.
Sourcepub fn block_hashes(
&self,
block_size: u32,
) -> Result<Vec<BlockHash>, KvHashingError>
pub fn block_hashes( &self, block_size: u32, ) -> Result<Vec<BlockHash>, KvHashingError>
Projection: per-block BlockHash.
Sourcepub fn sequence_hashes(
&self,
block_size: u32,
) -> Result<Vec<SequenceHash>, KvHashingError>
pub fn sequence_hashes( &self, block_size: u32, ) -> Result<Vec<SequenceHash>, KvHashingError>
Projection: per-block SequenceHash (parent-chained, derived from PLH).
Sourcepub fn positional_lineage_hashes(
&self,
block_size: u32,
) -> Result<Vec<PositionalLineageHash>, KvHashingError>
pub fn positional_lineage_hashes( &self, block_size: u32, ) -> Result<Vec<PositionalLineageHash>, KvHashingError>
Projection: per-block PositionalLineageHash (the universal identifier).
Source§impl Request
impl Request
Sourcepub fn builder() -> RequestBuilder
pub fn builder() -> RequestBuilder
Returns a fresh owned RequestBuilder.
Sourcepub fn mm_info(&self) -> &[RequestMmObjectInfo]
pub fn mm_info(&self) -> &[RequestMmObjectInfo]
Returns the validated, sorted multimodal runs.