Parse normalises s (case-insensitive, trimmed) and returns the matching Level. It returns ("", false) for unknown strings, adaptive values, and empty input. Use [IsValid] for full validation including adaptive forms.
(s string)
| 45 | // Level. It returns ("", false) for unknown strings, adaptive values, and |
| 46 | // empty input. Use [IsValid] for full validation including adaptive forms. |
| 47 | func Parse(s string) (Level, bool) { |
| 48 | l := normalize(s) |
| 49 | if allLevels[l] { |
| 50 | return l, true |
| 51 | } |
| 52 | return "", false |
| 53 | } |
| 54 | |
| 55 | // IsValid reports whether s is a recognised thinking_budget effort value. |
| 56 | // It accepts every [Level] constant, plain "adaptive", and the |