Skip to main content

squigit_brain/provider/gemini/
models.rs

1// Copyright 2026 a7mddra
2// SPDX-License-Identifier: Apache-2.0
3
4pub const BOOTSTRAP_LITE_MODEL: &str = "models/gemini-flash-lite-latest";
5pub const PRIMARY_FAST_MODEL: &str = "models/gemini-flash-latest";
6pub const PRIMARY_REASONING_MODEL: &str = "models/gemini-pro-latest";
7pub const DEFAULT_MODEL_EFFORT: &str = "medium";
8pub const MODEL_EFFORTS: &[&str] = &["low", "medium", "high"];
9
10#[derive(Clone, Copy, Debug)]
11pub struct SelectableModel {
12    pub id: &'static str,
13    pub name: &'static str,
14    pub provider: &'static str,
15}
16
17pub const SELECTABLE_MODELS: &[SelectableModel] = &[
18    SelectableModel {
19        id: PRIMARY_FAST_MODEL,
20        name: "Flash",
21        provider: "gemini",
22    },
23    SelectableModel {
24        id: PRIMARY_REASONING_MODEL,
25        name: "Pro",
26        provider: "gemini",
27    },
28];
29
30pub(crate) fn build_attempt_plan(model_id: &str, effort: &str) -> Result<Vec<String>, String> {
31    if !matches!(model_id, PRIMARY_FAST_MODEL | PRIMARY_REASONING_MODEL) {
32        return Err("invalid-model-selection: unsupported model ID".to_string());
33    }
34    if !MODEL_EFFORTS.contains(&effort) {
35        return Err("invalid-model-selection: unsupported effort".to_string());
36    }
37
38    let candidates = if model_id == PRIMARY_FAST_MODEL || effort == "low" {
39        vec![BOOTSTRAP_LITE_MODEL.to_string()]
40    } else {
41        vec![
42            PRIMARY_FAST_MODEL.to_string(),
43            BOOTSTRAP_LITE_MODEL.to_string(),
44        ]
45    };
46    Ok(candidates)
47}