/// Structure that holds a sequence of tokens broken into blocks where the blocks are hashed.
///
/// The block hashes computed are designed to be used externally from the LLM backend to provide uniqueness which must also
/// account for the differences in the model architecture, model weights, associated PEFT used to generate the sequence, etc.
///
/// To account for these differences, the salt hash is used as the seed for the hash function. One might choose to serialize some
/// metadata about the model, PEFT, etc, convert it to a byte slice using `serde_json::to_vec` then compute a u64 hash from that object
/// which can be used as the `salt_hash` for the [TokenBlockSequence].
///
/// There are two critical hashes:
/// - `block_hash`: a hash computed from only the local tokens within the block seeding the hashing function with the `salt_hash`
/// - `sequence_hash`: a hash computed from the previous block's `sequence_hash` and the current block's `block_hash` using the `salt_hash` as the seed
#[derive(Debug)]
pubstructTokenBlockSequence{
blocks:Vec<TokenBlock>,
current_block:PartialTokenBlock,
salt_hash:SaltHash,
}
implTokenBlockSequence{
/// Create a new [TokenBlockSequence] from a sequence of tokens.
///
/// The sequence is computed using the given block size and salt hash.
///
/// The salt hash is optional and if not provided, the default value of 0 will be used.
///
/// ## Example
///
/// ```rust
/// use dynamo_tokens::TokenBlockSequence;
///
/// let mut sequence = TokenBlockSequence::new(vec![1, 2, 3, 4, 5].into(), 4, Some(1337 as u64));