#[non_exhaustive]pub struct ModelPreferences {
pub hints: Option<Vec<ModelHint>>,
pub cost_priority: Option<f32>,
pub speed_priority: Option<f32>,
pub intelligence_priority: Option<f32>,
}Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Expand description
Preferences for model selection and behavior in sampling requests.
This allows servers to express their preferences for which model to use and how to balance different priorities when the client has multiple model options available.
Fields (Non-exhaustive)ยง
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.hints: Option<Vec<ModelHint>>Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Specific model names or families to prefer (e.g., โclaudeโ, โgptโ)
cost_priority: Option<f32>Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Priority for cost optimization (0.0 to 1.0, higher = prefer cheaper models)
speed_priority: Option<f32>Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Priority for speed/latency (0.0 to 1.0, higher = prefer faster models)
intelligence_priority: Option<f32>Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Priority for intelligence/capability (0.0 to 1.0, higher = prefer more capable models)
Implementationsยง
Sourceยงimpl ModelPreferences
impl ModelPreferences
Sourcepub fn new() -> ModelPreferences
pub fn new() -> ModelPreferences
Create a new default ModelPreferences.
Sourcepub fn with_hints(self, hints: Vec<ModelHint>) -> ModelPreferences
pub fn with_hints(self, hints: Vec<ModelHint>) -> ModelPreferences
Set hints for model selection.
Sourcepub fn with_cost_priority(self, cost_priority: f32) -> ModelPreferences
pub fn with_cost_priority(self, cost_priority: f32) -> ModelPreferences
Set cost priority (0.0 to 1.0).
Sourcepub fn with_speed_priority(self, speed_priority: f32) -> ModelPreferences
pub fn with_speed_priority(self, speed_priority: f32) -> ModelPreferences
Set speed priority (0.0 to 1.0).
Sourcepub fn with_intelligence_priority(
self,
intelligence_priority: f32,
) -> ModelPreferences
pub fn with_intelligence_priority( self, intelligence_priority: f32, ) -> ModelPreferences
Set intelligence priority (0.0 to 1.0).
Trait Implementationsยง
Sourceยงimpl Clone for ModelPreferences
impl Clone for ModelPreferences
Sourceยงfn clone(&self) -> ModelPreferences
fn clone(&self) -> ModelPreferences
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl Debug for ModelPreferences
impl Debug for ModelPreferences
Sourceยงimpl Default for ModelPreferences
impl Default for ModelPreferences
Sourceยงfn default() -> ModelPreferences
fn default() -> ModelPreferences
Sourceยงimpl<'de> Deserialize<'de> for ModelPreferences
impl<'de> Deserialize<'de> for ModelPreferences
Sourceยงfn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelPreferences, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelPreferences, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Sourceยงimpl JsonSchema for ModelPreferences
impl JsonSchema for ModelPreferences
Sourceยงfn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Sourceยงfn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Sourceยงfn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSourceยงimpl PartialEq for ModelPreferences
impl PartialEq for ModelPreferences
Sourceยงimpl Serialize for ModelPreferences
impl Serialize for ModelPreferences
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,
impl StructuralPartialEq for ModelPreferences
Auto Trait Implementationsยง
impl Freeze for ModelPreferences
impl RefUnwindSafe for ModelPreferences
impl Send for ModelPreferences
impl Sync for ModelPreferences
impl Unpin for ModelPreferences
impl UnsafeUnpin for ModelPreferences
impl UnwindSafe for ModelPreferences
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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