返回 CodeWhale
auto_reasoning.rs
根目录 / crates / tui / src / auto_reasoning.rs
1 //! Declared reasoning-effort tier policy for `Auto` mode (#663).
2 //!
3 //! When the user sets `reasoning_effort = "auto"`, the engine calls
4 //! [`select`] before each turn-level request to pick the actual tier.
5 //!
6 //! The tier is a declared policy, not a content classification. Until the
7 //! #6290 rework it guessed from the user's wording (`debug`/`error` → `Max`,
8 //! `search`/`lookup` → `Low`, with CJK/JP keyword lists) — the host-side
9 //! semantic-determinism class that made cost and answer quality depend on
10 //! vocabulary rather than the task. `auto` now means the declared default
11 //! below; the user's explicit tier is the precise control. A model-declared
12 //! escalation hint is the intended follow-up — this function is the seam a
13 //! real signal would land in.
14 //!
15 //! Known limitation: there is no per-turn cost policy left here. A turn whose
16 //! wording would once have classified as `Low` now runs at `High` unless the
17 //! user or the caller sets a tier explicitly; `auto` is not a cost-saver by
18 //! itself.
19
20 use crate::reasoning_preference::ReasoningEffort;
21
22 /// Choose a concrete `ReasoningEffort` tier for an `auto` setting.
23 ///
24 /// Declared policy: `High`. The message, the model, and the caller are never
25 /// inspected.
26 #[must_use]
27 pub fn select() -> ReasoningEffort {
28 ReasoningEffort::High
29 }
30
31 #[cfg(test)]
32 mod tests {
33 use super::*;
34
35 /// The declared default. Changing this value is a policy change: update the
36 /// resolution tests in `core/engine/turn_loop.rs` and `lib.rs` with it.
37 #[test]
38 fn declared_default_is_high() {
39 assert_eq!(select(), ReasoningEffort::High);
40 }
41 }
42
42 lines RUST