pub struct ModelSpec {
pub id: String,
pub variant: Option<String>,
pub limits: ModelLimits,
}Fields§
§id: String§variant: Option<String>§limits: ModelLimitsImplementations§
Source§impl ModelSpec
impl ModelSpec
pub fn new( id: impl Into<String>, context_window_tokens: NonZero<usize>, ) -> ModelSpec
pub fn with_limits( id: impl Into<String>, variant: Option<String>, limits: ModelLimits, ) -> ModelSpec
pub fn with_variant(self, variant: Option<String>) -> ModelSpec
Sourcepub fn from_token_limits(
id: impl Into<String>,
variant: Option<String>,
context_window_tokens: usize,
output_token_capacity: Option<usize>,
) -> Result<ModelSpec, String>
pub fn from_token_limits( id: impl Into<String>, variant: Option<String>, context_window_tokens: usize, output_token_capacity: Option<usize>, ) -> Result<ModelSpec, String>
Build a spec from the prompt budget (context_window_tokens — the
maximum input the provider accepts for this model on this route) and the
optional output cap. The budget is what history pruning and the UI
measure against.
pub fn context_window_tokens(&self) -> usize
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelSpec
impl<'de> Deserialize<'de> for ModelSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ModelSpec
Source§impl Serialize for ModelSpec
impl Serialize for ModelSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Mutably borrows from an owned value. Read more