#[non_exhaustive]pub struct ModelSpec {Show 13 fields
pub id: String,
pub provider: ProviderId,
pub display_name: String,
pub context_window: Option<u32>,
pub max_output_tokens: Option<u32>,
pub input: Modalities,
pub reasoning: ReasoningSupport,
pub caching: CacheSupport,
pub tools: bool,
pub structured_output: bool,
pub pricing: Option<Pricing>,
pub deprecated: bool,
pub sampling: Option<Sampling>,
/* private fields */
}Expand description
One model’s facts: limits, input modalities, the reasoning and caching it
takes, and its prices. Built by Catalog from its data.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringThe provider’s own model id.
provider: ProviderIdThe provider serving the model under Self::id.
display_name: StringA human-readable name.
context_window: Option<u32>The most tokens the model reads and writes in one request, if known.
max_output_tokens: Option<u32>The most tokens the model writes in one reply, if known.
input: ModalitiesWhat the model reads.
reasoning: ReasoningSupportThe reasoning the model takes.
caching: CacheSupportThe cache retentions the model honours.
tools: boolWhether the model calls tools.
structured_output: boolWhether the model constrains its output to a JSON schema.
pricing: Option<Pricing>Prices in USD per million tokens, if known.
deprecated: boolWhether the provider has deprecated the model.
sampling: Option<Sampling>When the model takes sampling parameters (temperature, top_p,
top_logprobs, logprobs), or None when unknown.
Implementations§
Source§impl ModelSpec
impl ModelSpec
Sourcepub fn validate(
&self,
options: &GenerationOptions,
) -> Result<(), UnsupportedOption>
pub fn validate( &self, options: &GenerationOptions, ) -> Result<(), UnsupportedOption>
Checks options against what the model takes: reasoning against
Self::reasoning and cache against Self::caching. The error
names the option, the provider’s vendor and this model. A reasoning
row with no reasoning options refuses every reasoning value (see
ReasoningSupport).
Trait Implementations§
Source§impl<'a> From<&'a ModelSpec> for ModelSelector<'a>
impl<'a> From<&'a ModelSpec> for ModelSelector<'a>
impl StructuralPartialEq for ModelSpec
Auto Trait Implementations§
impl Freeze for ModelSpec
impl RefUnwindSafe for ModelSpec
impl Send for ModelSpec
impl Sync for ModelSpec
impl Unpin for ModelSpec
impl UnsafeUnpin for ModelSpec
impl UnwindSafe for ModelSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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