pub struct ModelProfiles { /* private fields */ }Expand description
id → provider profile resolved once at boot from [models.<id>], plus the
launch provider (base) an unmapped model falls back to. The Default (no
base) does NOT manage providers: every operation is a no-op, so a bare
kernel embedder’s LlmOpts::default() is never touched. A BTreeMap (not
HashMap) keeps debug/--dump-* output deterministic.
PRECEDENCE: profile > flag(=base) > config/env globals. settle computes
base ⊕ profile, and base is the post-flag provider, so a field a profile
sets necessarily wins over the flag. Flags/env/config therefore set the
DEFAULT provider; a [models.<id>] entry overrides it for that model.
Implementations§
Source§impl ModelProfiles
impl ModelProfiles
Sourcepub fn new(base: LlmProvider) -> Self
pub fn new(base: LlmProvider) -> Self
Start managing: base is the provider an unmapped model falls back to.
Sourcepub fn settle(&self, llm: &mut LlmOpts)
pub fn settle(&self, llm: &mut LlmOpts)
Settle llm’s provider for llm.model: reset base_url/api_key to base,
overlay that model’s profile, then resolve the endpoint
(profile pin ▸ base pin ▸ model_protocol ▸ Chat). No-op when base is
None.
Sourcepub fn base(&self) -> Option<&LlmProvider>
pub fn base(&self) -> Option<&LlmProvider>
The launch provider an unmapped model falls back to; None when the map
is not managing providers (the Default). Re-forwarded verbatim across a
/reload / resume so the DEFAULT provider survives the process boundary.
Now carries an EndpointPref, so the PREF (not a resolved pin) survives
— that is exactly what keeps auto across a re-exec.
Sourcepub fn insert(&mut self, model: impl Into<String>, profile: LlmProfile)
pub fn insert(&mut self, model: impl Into<String>, profile: LlmProfile)
Register a profile for model (boot-time config build).
Trait Implementations§
Source§impl Clone for ModelProfiles
impl Clone for ModelProfiles
Source§impl Debug for ModelProfiles
impl Debug for ModelProfiles
Source§impl Default for ModelProfiles
impl Default for ModelProfiles
impl Eq for ModelProfiles
Source§impl PartialEq for ModelProfiles
impl PartialEq for ModelProfiles
impl StructuralPartialEq for ModelProfiles
Auto Trait Implementations§
impl Freeze for ModelProfiles
impl RefUnwindSafe for ModelProfiles
impl Send for ModelProfiles
impl Sync for ModelProfiles
impl Unpin for ModelProfiles
impl UnsafeUnpin for ModelProfiles
impl UnwindSafe for ModelProfiles
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.