ag_contracts/
reasoning.rs1use std::str::FromStr;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
7pub enum ReasoningLevel {
8 Low,
10 Medium,
12 #[default]
14 High,
15 XHigh,
17 Max,
19}
20
21impl ReasoningLevel {
22 pub const ALL: [Self; 5] = [Self::Low, Self::Medium, Self::High, Self::XHigh, Self::Max];
24
25 pub fn as_str(self) -> &'static str {
30 match self {
31 Self::Low => "low",
32 Self::Medium => "medium",
33 Self::High => "high",
34 Self::XHigh => "xhigh",
35 Self::Max => "max",
36 }
37 }
38
39 pub fn description(self) -> &'static str {
41 match self {
42 Self::Low => "Fastest responses with lighter reasoning.",
43 Self::Medium => "Balanced speed and reasoning depth.",
44 Self::High => "Deeper reasoning for tougher tasks.",
45 Self::XHigh => "Extra-high reasoning for complex tasks.",
46 Self::Max => "Maximum reasoning effort for the hardest tasks.",
47 }
48 }
49}
50
51impl FromStr for ReasoningLevel {
52 type Err = String;
53
54 fn from_str(value: &str) -> Result<Self, Self::Err> {
55 match value {
56 "low" => Ok(Self::Low),
57 "medium" => Ok(Self::Medium),
58 "high" => Ok(Self::High),
59 "xhigh" => Ok(Self::XHigh),
60 "max" => Ok(Self::Max),
61 other => Err(format!("unknown reasoning level: {other}")),
62 }
63 }
64}
65
66#[cfg(test)]
67#[path = "reasoning_test.rs"]
68mod tests;