pub mod grok_4 {
pub const GROK_4: &str = "grok-4";
pub const GROK_4_0709: &str = "grok-4-0709";
pub const GROK_4_LATEST: &str = "grok-4-latest";
pub const ALL: &[&str] = &[GROK_4, GROK_4_0709, GROK_4_LATEST];
}
pub mod grok_3 {
pub const GROK_3: &str = "grok-3";
pub const GROK_3_LATEST: &str = "grok-3-latest";
pub const GROK_3_MINI: &str = "grok-3-mini";
pub const GROK_3_FAST: &str = "grok-3-fast";
pub const GROK_3_FAST_LATEST: &str = "grok-3-fast-latest";
pub const GROK_3_FAST_BETA: &str = "grok-3-fast-beta";
pub const ALL: &[&str] = &[
GROK_3,
GROK_3_LATEST,
GROK_3_MINI,
GROK_3_FAST,
GROK_3_FAST_LATEST,
GROK_3_FAST_BETA,
];
}
pub mod grok_2 {
pub const GROK_2: &str = "grok-2";
pub const GROK_2_LATEST: &str = "grok-2-latest";
pub const GROK_2_1212: &str = "grok-2-1212";
pub const ALL: &[&str] = &[GROK_2, GROK_2_LATEST, GROK_2_1212];
}
pub mod images {
pub const GROK_2_IMAGE: &str = "grok-2-image";
pub const GROK_2_IMAGE_1212: &str = "grok-2-image-1212";
pub const ALL: &[&str] = &[GROK_2_IMAGE, GROK_2_IMAGE_1212];
}
pub mod legacy {
pub const GROK_BETA: &str = "grok-beta";
pub const ALL: &[&str] = &[GROK_BETA];
}
pub mod popular {
use super::*;
pub const FLAGSHIP: &str = grok_4::GROK_4;
pub const BALANCED: &str = grok_3::GROK_3;
pub const FAST: &str = grok_3::GROK_3_FAST;
pub const LIGHTWEIGHT: &str = grok_3::GROK_3_MINI;
pub const REASONING: &str = grok_4::GROK_4;
pub const LATEST: &str = grok_4::GROK_4_LATEST;
pub const IMAGE_GENERATION: &str = images::GROK_2_IMAGE;
}
pub use grok_2::GROK_2;
pub use grok_3::GROK_3;
pub use grok_3::GROK_3_FAST;
pub use grok_3::GROK_3_MINI;
pub use grok_4::GROK_4;
pub use images::GROK_2_IMAGE;
pub fn all_models() -> Vec<&'static str> {
let mut models = Vec::new();
models.extend_from_slice(grok_4::ALL);
models.extend_from_slice(grok_3::ALL);
models.extend_from_slice(grok_2::ALL);
models.extend_from_slice(images::ALL);
models.extend_from_slice(legacy::ALL);
models
}
pub mod by_capability {
use super::*;
pub const REASONING: &[&str] = &[grok_4::GROK_4, grok_4::GROK_4_0709, grok_4::GROK_4_LATEST];
pub const VISION: &[&str] = &[grok_4::GROK_4, grok_4::GROK_4_0709, grok_4::GROK_4_LATEST];
pub const IMAGE_GENERATION: &[&str] = images::ALL;
pub const FAST: &[&str] = &[
grok_3::GROK_3_FAST,
grok_3::GROK_3_FAST_LATEST,
grok_3::GROK_3_FAST_BETA,
grok_3::GROK_3_MINI,
];
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
#[allow(clippy::const_is_empty)]
fn test_model_constants() {
assert!(!grok_4::GROK_4.is_empty());
assert!(!grok_3::GROK_3.is_empty());
assert!(!grok_2::GROK_2.is_empty());
assert!(!images::GROK_2_IMAGE.is_empty());
}
#[test]
fn test_all_models() {
let models = all_models();
assert!(!models.is_empty());
assert!(models.contains(&grok_4::GROK_4));
assert!(models.contains(&grok_3::GROK_3));
}
#[test]
#[allow(clippy::const_is_empty)]
fn test_popular_recommendations() {
assert!(!popular::FLAGSHIP.is_empty());
assert!(!popular::BALANCED.is_empty());
assert!(!popular::REASONING.is_empty());
}
#[test]
#[allow(clippy::const_is_empty)]
fn test_capability_groups() {
assert!(!by_capability::REASONING.is_empty());
assert!(!by_capability::VISION.is_empty());
assert!(!by_capability::IMAGE_GENERATION.is_empty());
assert!(!by_capability::FAST.is_empty());
}
}