#[non_exhaustive]pub struct Price {
pub input_per_million: f64,
pub output_per_million: f64,
}Expand description
What a model costs, in the price unit of the providers file (any currency: the run’s cost budget is in millionths of it).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.input_per_million: f64§output_per_million: f64Implementations§
Source§impl Price
impl Price
Sourcepub fn new(
input_per_million: f64,
output_per_million: f64,
) -> Result<Self, LlmError>
pub fn new( input_per_million: f64, output_per_million: f64, ) -> Result<Self, LlmError>
A price, checked like one in a providers file.
@throws LlmError - Config for a negative, not finite or absurd price.
Sourcepub fn cost_micros(&self, usage: &Usage) -> u64
pub fn cost_micros(&self, usage: &Usage) -> u64
The cost of usage in micro units: a price per million tokens is the
cost of one token in micro units.
Trait Implementations§
impl Copy for Price
Source§impl<'de> Deserialize<'de> for Price
impl<'de> Deserialize<'de> for Price
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Price
Auto Trait Implementations§
impl Forget for Price
impl Freeze for Price
impl Move for Price
impl RefUnwindSafe for Price
impl Send for Price
impl Sync for Price
impl Unpin for Price
impl UnsafeUnpin for Price
impl UnwindSafe for Price
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