use alloc::collections::BTreeMap;
use std::path::{
Path,
PathBuf,
};
use super::{
LayaAgentConfig,
LayaModel,
};
pub use crate::kits::support::construct::{
TOKENIZER,
TOKENIZER_CONFIG,
};
#[derive(Debug)]
pub struct LayaConstruct {
pub model: LayaModel,
pub agent: LayaAgentConfig,
pub files: BTreeMap<String, PathBuf>,
}
impl LayaConstruct {
pub fn new(
model: LayaModel,
agent: LayaAgentConfig,
) -> Self {
Self {
model,
agent,
files: BTreeMap::new(),
}
}
pub fn with_file(
mut self,
key: impl Into<String>,
path: impl Into<PathBuf>,
) -> Self {
self.files.insert(key.into(), path.into());
self
}
pub fn file(
&self,
key: &str,
) -> Option<&Path> {
self.files.get(key).map(PathBuf::as_path)
}
pub fn tokenizer(&self) -> Option<&Path> {
self.file(TOKENIZER)
}
pub fn tokenizer_config(&self) -> Option<&Path> {
self.file(TOKENIZER_CONFIG)
}
}