pub struct ModelCapabilities {
pub context_length: usize,
pub max_output_tokens: usize,
pub supports_tools: bool,
pub supports_vision: bool,
pub supports_streaming: bool,
pub provider: String,
pub model_id: String,
pub source: CapabilitySource,
}Expand description
Model capabilities describing limits and supported features.
Fields§
§context_length: usizeMaximum context window in tokens, always stored as input + output
combined regardless of whether the provider exposes a single combined
limit (e.g. OpenAI) or separate per-modality limits (e.g. Anthropic
max_input_tokens, Gemini inputTokenLimit).
Do not use this field directly for prompt-budget decisions. Always
call Self::max_input_tokens() instead, which subtracts
max_output_tokens to yield the tokens available for the prompt.
§Invariant
context_length = max_input_tokens() + max_output_tokens
Discovery code for providers with separate input/output limits must
store input_limit + output_limit here so that max_input_tokens()
correctly recovers input_limit without double-subtracting.
max_output_tokens: usizeMaximum output/completion tokens the model can generate
supports_tools: boolWhether the model supports native tool/function calling
supports_vision: boolWhether the model supports vision/image inputs
supports_streaming: boolWhether the model supports streaming responses
provider: StringProvider name for reference
model_id: StringModel ID for reference
source: CapabilitySourceHow this capability was discovered
Implementations§
Source§impl ModelCapabilities
impl ModelCapabilities
Sourcepub fn new(
provider: &str,
model_id: &str,
context_length: usize,
max_output_tokens: usize,
source: CapabilitySource,
) -> Self
pub fn new( provider: &str, model_id: &str, context_length: usize, max_output_tokens: usize, source: CapabilitySource, ) -> Self
Create capabilities with known values
Sourcepub fn with_vision(self, supports: bool) -> Self
pub fn with_vision(self, supports: bool) -> Self
Set vision support
Sourcepub fn with_tools(self, supports: bool) -> Self
pub fn with_tools(self, supports: bool) -> Self
Set tool support
Sourcepub fn max_input_tokens(&self) -> usize
pub fn max_input_tokens(&self) -> usize
Calculate the effective max input tokens (context - reserved output)
Sourcepub fn is_reliable(&self) -> bool
pub fn is_reliable(&self) -> bool
Check if this capability is from a reliable source
Trait Implementations§
Source§impl Clone for ModelCapabilities
impl Clone for ModelCapabilities
Source§fn clone(&self) -> ModelCapabilities
fn clone(&self) -> ModelCapabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelCapabilities
impl Debug for ModelCapabilities
Source§impl Default for ModelCapabilities
impl Default for ModelCapabilities
Source§impl<'de> Deserialize<'de> for ModelCapabilities
impl<'de> Deserialize<'de> for ModelCapabilities
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 ModelCapabilities
impl PartialEq for ModelCapabilities
Source§impl Serialize for ModelCapabilities
impl Serialize for ModelCapabilities
impl Eq for ModelCapabilities
impl StructuralPartialEq for ModelCapabilities
Auto Trait Implementations§
impl Freeze for ModelCapabilities
impl RefUnwindSafe for ModelCapabilities
impl Send for ModelCapabilities
impl Sync for ModelCapabilities
impl Unpin for ModelCapabilities
impl UnwindSafe for ModelCapabilities
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].