pub struct ModelRequestLimits { /* private fields */ }Expand description
Finite, provider-neutral ceilings for one model request.
Input and output token ceilings are both positive. Their checked sum is the minimum total context capacity used during model negotiation. Content bytes cover inline text/JSON plus every referenced instruction/message artifact; tool-schema bytes are governed by the trusted schema registry profile.
Implementations§
Source§impl ModelRequestLimits
impl ModelRequestLimits
Sourcepub const HARD_MAX_CONTENT_BYTES: ByteCount
pub const HARD_MAX_CONTENT_BYTES: ByteCount
Immutable v1 ceiling for resolved instruction and message bytes.
Sourcepub const fn new(
max_input_tokens: TokenCount,
max_output_tokens: TokenCount,
max_content_bytes: ByteCount,
) -> Result<Self, ModelRequestLimitsError>
pub const fn new( max_input_tokens: TokenCount, max_output_tokens: TokenCount, max_content_bytes: ByteCount, ) -> Result<Self, ModelRequestLimitsError>
Constructs finite request ceilings.
§Errors
Returns ModelRequestLimitsError for zero token/byte capacity, a
content ceiling above the hard resource limit, or token-sum overflow.
Sourcepub const fn max_input_tokens(&self) -> TokenCount
pub const fn max_input_tokens(&self) -> TokenCount
Returns the local input-token ceiling used for preflight and selection.
Sourcepub const fn max_output_tokens(&self) -> TokenCount
pub const fn max_output_tokens(&self) -> TokenCount
Returns the inclusive generated output-token ceiling.
Sourcepub const fn max_content_bytes(&self) -> ByteCount
pub const fn max_content_bytes(&self) -> ByteCount
Returns the maximum resolved instruction and message bytes.
Sourcepub fn required_context_tokens(&self) -> TokenCount
pub fn required_context_tokens(&self) -> TokenCount
Returns the checked total context capacity required by this request.
Trait Implementations§
Source§impl Clone for ModelRequestLimits
impl Clone for ModelRequestLimits
Source§impl Debug for ModelRequestLimits
impl Debug for ModelRequestLimits
Source§impl<'de> Deserialize<'de> for ModelRequestLimits
impl<'de> Deserialize<'de> for ModelRequestLimits
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 ModelRequestLimits
Source§impl JsonSchema for ModelRequestLimits
impl JsonSchema for ModelRequestLimits
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