pub struct ParamSpec {
pub key: String,
pub param_type: ParamType,
pub default_value: Option<JsonValue>,
pub range: Option<Vec<JsonValue>>,
pub values: Option<Vec<String>>,
}Expand description
The schema of one tunable parameter a model exposes.
Fields§
§key: StringThe parameter’s key, e.g. temperature.
param_type: ParamTypeThe parameter’s type.
default_value: Option<JsonValue>The default value, if any.
range: Option<Vec<JsonValue>>The [min, max] range for numeric parameters, if any.
values: Option<Vec<String>>The allowed values for an enum parameter, if any.
Implementations§
Source§impl ParamSpec
impl ParamSpec
Sourcepub fn int_range(&self) -> Option<(i64, i64)>
pub fn int_range(&self) -> Option<(i64, i64)>
The integer (min, max) range, if the spec declares a two-element numeric
range with min <= max.
Sourcepub fn double_range(&self) -> Option<(f64, f64)>
pub fn double_range(&self) -> Option<(f64, f64)>
The floating-point (min, max) range, if the spec declares a two-element
numeric range with min <= max.
Sourcepub fn normalized(&self, value: &JsonValue) -> Option<JsonValue>
pub fn normalized(&self, value: &JsonValue) -> Option<JsonValue>
Coerce and clamp value to this spec, or None if it cannot be a value of
this type. Ints and floats are clamped to the range when one is declared
(a float coerces from an int and vice versa); an enum must be a listed
value; a bool or string must already match the type.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ParamSpec
impl<'de> Deserialize<'de> for ParamSpec
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 ParamSpec
Auto Trait Implementations§
impl Freeze for ParamSpec
impl RefUnwindSafe for ParamSpec
impl Send for ParamSpec
impl Sync for ParamSpec
impl Unpin for ParamSpec
impl UnsafeUnpin for ParamSpec
impl UnwindSafe for ParamSpec
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