use std::path::PathBuf;
use std::sync::Arc;
use chat_core::types::provider_meta::ProviderMeta;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Sampling {
Greedy,
TopK { k: u32, seed: Option<u64> },
TopP { p: f64, seed: Option<u64> },
}
#[derive(Debug, Default)]
pub(crate) struct Config {
pub(crate) lora: Option<PathBuf>,
pub(crate) temperature: Option<f64>,
pub(crate) max_tokens: Option<u32>,
pub(crate) sampling: Option<Sampling>,
}
#[derive(Clone, Debug)]
pub struct AppleFMClient {
pub(crate) config: Arc<Config>,
pub(crate) meta: Arc<ProviderMeta>,
}
impl AppleFMClient {
pub fn model_slug(&self) -> String {
match self.config.lora.as_deref().and_then(|p| p.file_stem()) {
Some(stem) => format!("apple-on-device+{}", stem.to_string_lossy()),
None => "apple-on-device".to_owned(),
}
}
pub fn provider_meta(&self) -> &ProviderMeta {
&self.meta
}
}