#[non_exhaustive]pub enum ReasoningSupport {
None,
Unknown {
default: Option<Effort>,
},
Listed {
levels: Vec<Effort>,
budget: Option<RangeInclusive<u32>>,
can_disable: bool,
default: Option<Effort>,
},
}Expand description
The reasoning a model takes, in one of three states: it does not reason, it reasons but the catalog does not say which controls it takes, or it reasons and takes exactly the listed controls.
A catalog row that marks a model as reasoning but lists no reasoning
options (most of them gateway rows on HuggingFace, OpenRouter, Venice and
Bedrock) is Self::Unknown, which refuses nothing, as an empty
CacheSupport does. Only a row whose hand-reviewed rig facts say
"reasoning_control": "none" (a model whose API rejects every reasoning
control) is Self::Listed with nothing listed.
use rig_core::catalog::ReasoningSupport;
use rig_core::completion::{Effort, Reasoning};
let unknown = ReasoningSupport::Unknown { default: None };
assert!(unknown.supported() && unknown.levels().is_none());
assert_eq!(unknown.refusal(&Reasoning::Effort(Effort::High)), None);
let listed = ReasoningSupport::Listed {
levels: vec![Effort::Low, Effort::High],
budget: None,
can_disable: false,
default: Some(Effort::High),
};
assert!(listed.refusal(&Reasoning::Off).is_some());
assert_eq!(listed.refusal(&Reasoning::Effort(Effort::Low)), None);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
The model does not reason.
Unknown
The model reasons; the catalog does not say which controls it takes. Nothing is refused.
Listed
The model reasons and takes exactly these controls.
Fields
budget: Option<RangeInclusive<u32>>The reasoning-token budgets it takes, if it takes one.
Implementations§
Source§impl ReasoningSupport
impl ReasoningSupport
Sourcepub fn choices(&self) -> Vec<ReasoningChoice>
pub fn choices(&self) -> Vec<ReasoningChoice>
The reasoning settings the model takes: the provider default first,
then off when reasoning can be turned off, then each effort level,
or low, medium and high budgets on a model that takes a budget
and no levels. A model whose controls the catalog does not list
offers only the default.
Sourcepub fn named(&self, name: &str) -> Result<ReasoningChoice, UnknownReasoning>
pub fn named(&self, name: &str) -> Result<ReasoningChoice, UnknownReasoning>
The choice of Self::choices named name.
§Errors
UnknownReasoning with the names there are, when none is name.
Sourcepub fn levels(&self) -> Option<&[Effort]>
pub fn levels(&self) -> Option<&[Effort]>
The effort levels the model takes: empty when it takes none (or does
not reason), None when the catalog does not know, in which case a
picker shows every level.
Sourcepub fn budget(&self) -> Option<&RangeInclusive<u32>>
pub fn budget(&self) -> Option<&RangeInclusive<u32>>
The reasoning-token budgets the model takes, if the catalog lists
one. None both when it takes no budget and when the catalog does
not know; Self::levels tells the two apart.
Sourcepub fn can_disable(&self) -> Option<bool>
pub fn can_disable(&self) -> Option<bool>
Whether a request can turn the model’s reasoning off: Some(false)
for a model that does not reason, None when the catalog does not
know.
Sourcepub fn default_effort(&self) -> Option<Effort>
pub fn default_effort(&self) -> Option<Effort>
The effort the model uses when a request names none, if documented.
Trait Implementations§
Source§impl Clone for ReasoningSupport
impl Clone for ReasoningSupport
Source§impl Debug for ReasoningSupport
impl Debug for ReasoningSupport
Source§impl Default for ReasoningSupport
impl Default for ReasoningSupport
Source§impl<'de> Deserialize<'de> for ReasoningSupport
impl<'de> Deserialize<'de> for ReasoningSupport
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>,
impl Eq for ReasoningSupport
Source§impl PartialEq for ReasoningSupport
impl PartialEq for ReasoningSupport
Source§impl Serialize for ReasoningSupport
impl Serialize for ReasoningSupport
impl StructuralPartialEq for ReasoningSupport
Auto Trait Implementations§
impl Freeze for ReasoningSupport
impl RefUnwindSafe for ReasoningSupport
impl Send for ReasoningSupport
impl Sync for ReasoningSupport
impl Unpin for ReasoningSupport
impl UnsafeUnpin for ReasoningSupport
impl UnwindSafe for ReasoningSupport
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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