pub struct ModelTokenLimits { /* private fields */ }Expand description
Explicitly known token ceilings for one model-and-endpoint binding.
Context is the total provider-tokenized active context, including request content and reserved/generated output. Input and output are independent provider ceilings and need not be simultaneously attainable. Unknown values are represented by absence and fail any positive capacity requirement; they are never treated as unlimited.
Implementations§
Source§impl ModelTokenLimits
impl ModelTokenLimits
Sourcepub const fn new(
max_context_tokens: Option<TokenCount>,
max_input_tokens: Option<TokenCount>,
max_output_tokens: Option<TokenCount>,
) -> Result<Self, ModelTokenLimitsError>
pub const fn new( max_context_tokens: Option<TokenCount>, max_input_tokens: Option<TokenCount>, max_output_tokens: Option<TokenCount>, ) -> Result<Self, ModelTokenLimitsError>
Constructs and cross-validates known token ceilings.
§Errors
Returns ModelTokenLimitsError when a known ceiling is zero or a
component ceiling exceeds a known total context ceiling.
Sourcepub const fn unknown() -> Self
pub const fn unknown() -> Self
Constructs a capability snapshot with no provider-published token limits.
Sourcepub const fn max_context_tokens(&self) -> Option<TokenCount>
pub const fn max_context_tokens(&self) -> Option<TokenCount>
Returns the known total context ceiling.
Sourcepub const fn max_input_tokens(&self) -> Option<TokenCount>
pub const fn max_input_tokens(&self) -> Option<TokenCount>
Returns the known input-token ceiling.
Sourcepub const fn max_output_tokens(&self) -> Option<TokenCount>
pub const fn max_output_tokens(&self) -> Option<TokenCount>
Returns the known output-token ceiling.
Trait Implementations§
Source§impl Clone for ModelTokenLimits
impl Clone for ModelTokenLimits
Source§impl Debug for ModelTokenLimits
impl Debug for ModelTokenLimits
Source§impl<'de> Deserialize<'de> for ModelTokenLimits
impl<'de> Deserialize<'de> for ModelTokenLimits
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>,
impl Eq for ModelTokenLimits
Source§impl JsonSchema for ModelTokenLimits
impl JsonSchema for ModelTokenLimits
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more