pub struct ModelProvenance {
pub model: EmbeddingModel,
pub model_id: String,
pub hash: String,
pub loaded_at: SystemTime,
pub loaded_at_iso: String,
}Expand description
Stable: external consumers may depend on this; breaking changes require a SemVer bump.
Model provenance information for security audits.
Tracks metadata about when and how a model was loaded, including a hash for verification that the model hasn’t been tampered with.
§Example
use lattice_embed::{EmbeddingModel, ModelProvenance};
// Created when a model is loaded
let provenance = ModelProvenance::new(
EmbeddingModel::BgeSmallEnV15,
"BAAI/bge-small-en-v1.5".to_string(),
);
assert!(provenance.model_id.contains("BAAI"));
assert!(!provenance.hash.is_empty());Fields§
§model: EmbeddingModelStable: model variant that was loaded.
model_id: StringStable: source identifier (HuggingFace ID, URL, or file path).
hash: StringStable: Blake3 hash of the model identifier + timestamp for uniqueness.
Note: This is a lightweight hash based on metadata, not a full hash of model weights (which would be expensive). For full model verification, use the lattice-inference library’s built-in checksum verification.
loaded_at: SystemTimeStable: when the model was loaded.
loaded_at_iso: StringStable: formatted timestamp string for convenience.
Implementations§
Source§impl ModelProvenance
impl ModelProvenance
Sourcepub fn new(model: EmbeddingModel, model_id: String) -> Self
pub fn new(model: EmbeddingModel, model_id: String) -> Self
Stable: create new provenance information for a loaded model.
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Stable: get the model dimensions.
Sourcepub fn matches_model(&self, expected: EmbeddingModel) -> bool
pub fn matches_model(&self, expected: EmbeddingModel) -> bool
Stable: check if this provenance matches expected model.
Trait Implementations§
Source§impl Clone for ModelProvenance
impl Clone for ModelProvenance
Source§fn clone(&self) -> ModelProvenance
fn clone(&self) -> ModelProvenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more