pub struct ModelAliasSpec {
pub alias: String,
pub task: ModelTask,
pub provider_id: String,
pub model_id: String,
pub revision: Option<String>,
pub warmup: WarmupPolicy,
pub required: bool,
pub timeout: Option<u64>,
pub load_timeout: Option<u64>,
pub retry: Option<RetryConfig>,
pub options: Value,
}Expand description
Declarative specification that maps a human-readable alias to a concrete provider and model.
A model catalog is a Vec<ModelAliasSpec> — either built programmatically or
parsed from JSON with catalog_from_str / catalog_from_file.
§Example JSON
{
"alias": "embed/default",
"task": "embed",
"provider_id": "local/candle",
"model_id": "sentence-transformers/all-MiniLM-L6-v2",
"warmup": "lazy"
}Fields§
§alias: StringHuman-readable name used to request this model (e.g. "embed/default").
Must contain a / separator.
task: ModelTaskThe inference task this alias targets.
provider_id: StringIdentifier of the provider that will load this model (e.g. "local/candle",
"remote/openai").
model_id: StringModel identifier understood by the provider — typically a HuggingFace repo ID for local providers or an API model name for remote providers.
revision: Option<String>Optional HuggingFace revision (branch, tag, or commit hash).
warmup: WarmupPolicyWhen this model should be initialized. Defaults to WarmupPolicy::Lazy.
required: boolIf true, a failed eager warmup aborts runtime startup. Defaults to false.
timeout: Option<u64>Per-inference timeout in seconds. None means no timeout.
load_timeout: Option<u64>Model load timeout in seconds. Defaults to 600 s if unset.
retry: Option<RetryConfig>Retry configuration for transient inference failures.
options: ValueProvider-specific options (e.g. {"isq": "Q4K"} for mistral.rs,
{"api_key_env": "MY_KEY"} for remote providers). Defaults to {}.
Implementations§
Source§impl ModelAliasSpec
impl ModelAliasSpec
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate invariants: alias must be non-empty and contain a '/', timeouts
must be non-zero when set.
Sourcepub fn from_json(value: Value) -> Result<Self>
pub fn from_json(value: Value) -> Result<Self>
Parse a single ModelAliasSpec from a JSON value.
Sourcepub fn from_json_str(s: &str) -> Result<Self>
pub fn from_json_str(s: &str) -> Result<Self>
Parse a single ModelAliasSpec from a JSON string.
Trait Implementations§
Source§impl Clone for ModelAliasSpec
impl Clone for ModelAliasSpec
Source§fn clone(&self) -> ModelAliasSpec
fn clone(&self) -> ModelAliasSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelAliasSpec
impl Debug for ModelAliasSpec
Source§impl<'de> Deserialize<'de> for ModelAliasSpec
impl<'de> Deserialize<'de> for ModelAliasSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ModelAliasSpec
impl PartialEq for ModelAliasSpec
Source§impl Serialize for ModelAliasSpec
impl Serialize for ModelAliasSpec
impl StructuralPartialEq for ModelAliasSpec
Auto Trait Implementations§
impl Freeze for ModelAliasSpec
impl RefUnwindSafe for ModelAliasSpec
impl Send for ModelAliasSpec
impl Sync for ModelAliasSpec
impl Unpin for ModelAliasSpec
impl UnsafeUnpin for ModelAliasSpec
impl UnwindSafe for ModelAliasSpec
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,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.