liquid_edge/model.rs
1//! Model abstraction layer for liquid-edge
2//!
3//! This module provides abstractions for different types of models that can be
4//! loaded and used with the liquid-edge inference runtime.
5
6use crate::error::EdgeResult;
7use serde_json::Value;
8use std::collections::HashMap;
9use std::path::Path;
10
11/// Trait representing a model that can be loaded and used for inference
12pub trait Model: Send + Sync + std::fmt::Debug {
13 /// Get the model type (e.g., "onnx", "tensorrt", "coreml")
14 fn model_type(&self) -> &str;
15
16 /// Get the model path or identifier
17 fn model_path(&self) -> &Path;
18
19 /// Get model metadata
20 fn metadata(&self) -> &HashMap<String, Value>;
21
22 /// Get model configuration as JSON
23 fn config(&self) -> EdgeResult<Value>;
24
25 /// Validate that the model files exist and are valid
26 fn validate(&self) -> EdgeResult<()>;
27}