pub struct Dial { /* private fields */ }Expand description
The effort a request carries, read per request.
The issue this exists for: [provider] reasoning_effort is copied into the client’s options when
the client is built, so the one moment you want a different level — right after a turn that
thought too little — is the one the running session cannot do. So the configured level stays the
default, and a session override sits in front of it, in an Arc shared by every route the
session opened.
Implementations§
Source§impl Dial
impl Dial
pub fn new(configured: Option<String>) -> Self
Sourcepub fn effort(&self) -> Option<String>
pub fn effort(&self) -> Option<String>
What the next request should ask for: the session’s override, else the configuration.
Sourcepub fn set_session(&self, level: Option<String>)
pub fn set_session(&self, level: Option<String>)
/reasoning <level>: from the next request on, in this process only.
Sourcepub fn clear_session(&self)
pub fn clear_session(&self)
Drop the override: the configuration is in force again.
Sourcepub fn configured(&self) -> Option<&str>
pub fn configured(&self) -> Option<&str>
What was configured, for a report that has to say “the same as the file”.
Sourcepub fn overridden(&self) -> bool
pub fn overridden(&self) -> bool
Whether a session override is in force.
Sourcepub fn in_force(&self) -> String
pub fn in_force(&self) -> String
The level in force, with the one clause that makes an override visible: high,
high (this session; config.toml says low), medium (this backend's default; config.toml sets nothing), or not sent.
This is the read-out’s wording and /reasoning’s, from one function, so the line under the
composer cannot claim a level the report does not. Three answers, because a dial has three:
the session asked (/reasoning high), the file asked, or neither did and the route’s own
policy supplies the shipped default (#276). not sent is the fourth case and a fact, not
a shrug: the backend takes no level, or nobody declared one, so the field is not on the wire.
Source§impl Dial
impl Dial
Sourcepub fn in_force_report(&self, default: Option<&str>) -> InForce
pub fn in_force_report(&self, default: Option<&str>) -> InForce
The dial’s own half of InForce: what it will ask for, why, and what that becomes.
default is the route in force’s declared default (#276): Some("medium") on both
shipped profiles, None for a backend that declares no policy or no default. With no
session override and no file value, that is the level the next request carries — and the
label says not sent, not a guessed level, when even that is absent.