pub struct ModelCard {
pub id: String,
pub abbrev: String,
pub provider: Provider,
pub encoding: Encoding,
pub context_length: u32,
pub defaults: HashMap<String, Value>,
pub supported_params: HashSet<String>,
pub pricing: Option<Pricing>,
pub supports_streaming: bool,
pub supports_tools: bool,
pub supports_vision: bool,
}Expand description
Model metadata card
Contains all metadata needed for compression, token counting, and optimization.
Fields§
§id: StringFull model ID (e.g., “openai/gpt-4o”)
abbrev: StringShort abbreviation for compression (e.g., “og4o”)
provider: ProviderProvider
encoding: EncodingTokenizer encoding
context_length: u32Context window size (max input + output tokens)
defaults: HashMap<String, Value>Default parameter values (for removal during compression)
supported_params: HashSet<String>Supported parameters
pricing: Option<Pricing>Pricing information (optional)
supports_streaming: boolWhether this model supports streaming
supports_tools: boolWhether this model supports function/tool calling
supports_vision: boolWhether this model supports vision/images
Implementations§
Source§impl ModelCard
impl ModelCard
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new model card with auto-generated abbreviation
Sourcepub fn with_abbrev(id: impl Into<String>, abbrev: impl Into<String>) -> Self
pub fn with_abbrev(id: impl Into<String>, abbrev: impl Into<String>) -> Self
Create model card with explicit abbreviation
Sourcepub fn context_length(self, context_length: u32) -> Self
pub fn context_length(self, context_length: u32) -> Self
Builder: set context length
Sourcepub fn with_tools(self) -> Self
pub fn with_tools(self) -> Self
Builder: enable tools support
Sourcepub fn with_vision(self) -> Self
pub fn with_vision(self) -> Self
Builder: enable vision support
Sourcepub fn generate_abbrev(id: &str, provider: Provider) -> String
pub fn generate_abbrev(id: &str, provider: Provider) -> String
Generate abbreviation from model ID
The abbreviation scheme:
- Provider prefix (1-2 chars): o=OpenAI, m=Meta, mi=Mistral, etc.
- Compressed model name: remove common prefixes, compress version numbers
Examples:
openai/gpt-4o->og4ometa-llama/llama-3.1-405b->ml31405bdeepseek/deepseek-v3->dv3
Source§impl ModelCard
impl ModelCard
Sourcepub fn from_openrouter(model: OpenRouterModel) -> Self
pub fn from_openrouter(model: OpenRouterModel) -> Self
Create ModelCard from OpenRouter API model
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelCard
impl<'de> Deserialize<'de> for ModelCard
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>,
Auto Trait Implementations§
impl Freeze for ModelCard
impl RefUnwindSafe for ModelCard
impl Send for ModelCard
impl Sync for ModelCard
impl Unpin for ModelCard
impl UnwindSafe for ModelCard
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,
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