llm_models/local_model/
mod.rs

1// Public modules
2pub mod chat_template;
3pub mod gguf;
4pub mod hf_loader;
5pub mod metadata;
6
7// Internal imports
8use super::LlmModelBase;
9use crate::LlmChatTemplate;
10use gguf::GgufLoader;
11use metadata::LocalLlmMetadata;
12
13pub struct LocalLlmModel {
14    pub model_base: LlmModelBase,
15    pub local_model_path: std::path::PathBuf,
16    pub model_metadata: LocalLlmMetadata,
17    pub chat_template: LlmChatTemplate,
18}
19
20impl Default for LocalLlmModel {
21    fn default() -> Self {
22        let mut loader = GgufLoader::default();
23        loader.load().expect("Failed to load LlmPreset")
24    }
25}
26
27impl std::fmt::Debug for LocalLlmModel {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        let mut debug_struct = f.debug_struct("LocalLlmModel");
30        debug_struct.field("model_id", &self.model_base.model_id);
31        debug_struct.field("local_model_path", &self.local_model_path);
32        debug_struct.field("model_metadata", &self.model_metadata);
33        debug_struct.field("chat_template", &self.chat_template);
34        debug_struct.finish()
35    }
36}