Add gpt-4o-mini as an available model (#14770)

Release Notes:

- Fixes #14769
This commit is contained in:
versecafe 2024-07-19 00:32:56 -04:00 committed by GitHub
parent 48211e8ce2
commit 18b5a87298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View File

@ -396,6 +396,7 @@
// 2. "gpt-4" // 2. "gpt-4"
// 3. "gpt-4-turbo-preview" // 3. "gpt-4-turbo-preview"
// 4. "gpt-4o" // 4. "gpt-4o"
// 5. "gpt-4o-mini"
"default_model": "gpt-4o" "default_model": "gpt-4o"
} }
}, },

View File

@ -23,6 +23,7 @@ pub enum CloudModel {
Gpt4Turbo, Gpt4Turbo,
#[default] #[default]
Gpt4Omni, Gpt4Omni,
Gpt4OmniMini,
Claude3_5Sonnet, Claude3_5Sonnet,
Claude3Opus, Claude3Opus,
Claude3Sonnet, Claude3Sonnet,
@ -107,6 +108,7 @@ impl CloudModel {
Self::Gpt4 => "gpt-4", Self::Gpt4 => "gpt-4",
Self::Gpt4Turbo => "gpt-4-turbo-preview", Self::Gpt4Turbo => "gpt-4-turbo-preview",
Self::Gpt4Omni => "gpt-4o", Self::Gpt4Omni => "gpt-4o",
Self::Gpt4OmniMini => "gpt-4o-mini",
Self::Claude3_5Sonnet => "claude-3-5-sonnet", Self::Claude3_5Sonnet => "claude-3-5-sonnet",
Self::Claude3Opus => "claude-3-opus", Self::Claude3Opus => "claude-3-opus",
Self::Claude3Sonnet => "claude-3-sonnet", Self::Claude3Sonnet => "claude-3-sonnet",
@ -123,6 +125,7 @@ impl CloudModel {
Self::Gpt4 => "GPT 4", Self::Gpt4 => "GPT 4",
Self::Gpt4Turbo => "GPT 4 Turbo", Self::Gpt4Turbo => "GPT 4 Turbo",
Self::Gpt4Omni => "GPT 4 Omni", Self::Gpt4Omni => "GPT 4 Omni",
Self::Gpt4OmniMini => "GPT 4 Omni Mini",
Self::Claude3_5Sonnet => "Claude 3.5 Sonnet", Self::Claude3_5Sonnet => "Claude 3.5 Sonnet",
Self::Claude3Opus => "Claude 3 Opus", Self::Claude3Opus => "Claude 3 Opus",
Self::Claude3Sonnet => "Claude 3 Sonnet", Self::Claude3Sonnet => "Claude 3 Sonnet",
@ -138,6 +141,7 @@ impl CloudModel {
Self::Gpt3Point5Turbo => 2048, Self::Gpt3Point5Turbo => 2048,
Self::Gpt4 => 4096, Self::Gpt4 => 4096,
Self::Gpt4Turbo | Self::Gpt4Omni => 128000, Self::Gpt4Turbo | Self::Gpt4Omni => 128000,
Self::Gpt4OmniMini => 128000,
Self::Claude3_5Sonnet Self::Claude3_5Sonnet
| Self::Claude3Opus | Self::Claude3Opus
| Self::Claude3Sonnet | Self::Claude3Sonnet

View File

@ -59,6 +59,8 @@ pub enum Model {
#[serde(rename = "gpt-4o", alias = "gpt-4o-2024-05-13")] #[serde(rename = "gpt-4o", alias = "gpt-4o-2024-05-13")]
#[default] #[default]
FourOmni, FourOmni,
#[serde(rename = "gpt-4o-mini", alias = "gpt-4o-mini-2024-07-18")]
FourOmniMini,
#[serde(rename = "custom")] #[serde(rename = "custom")]
Custom { name: String, max_tokens: usize }, Custom { name: String, max_tokens: usize },
} }
@ -70,6 +72,7 @@ impl Model {
"gpt-4" => Ok(Self::Four), "gpt-4" => Ok(Self::Four),
"gpt-4-turbo-preview" => Ok(Self::FourTurbo), "gpt-4-turbo-preview" => Ok(Self::FourTurbo),
"gpt-4o" => Ok(Self::FourOmni), "gpt-4o" => Ok(Self::FourOmni),
"gpt-4o-mini" => Ok(Self::FourOmniMini),
_ => Err(anyhow!("invalid model id")), _ => Err(anyhow!("invalid model id")),
} }
} }
@ -80,6 +83,7 @@ impl Model {
Self::Four => "gpt-4", Self::Four => "gpt-4",
Self::FourTurbo => "gpt-4-turbo-preview", Self::FourTurbo => "gpt-4-turbo-preview",
Self::FourOmni => "gpt-4o", Self::FourOmni => "gpt-4o",
Self::FourOmniMini => "gpt-4o-mini",
Self::Custom { .. } => "custom", Self::Custom { .. } => "custom",
} }
} }
@ -90,17 +94,19 @@ impl Model {
Self::Four => "gpt-4", Self::Four => "gpt-4",
Self::FourTurbo => "gpt-4-turbo", Self::FourTurbo => "gpt-4-turbo",
Self::FourOmni => "gpt-4o", Self::FourOmni => "gpt-4o",
Self::FourOmniMini => "gpt-4o-mini",
Self::Custom { name, .. } => name, Self::Custom { name, .. } => name,
} }
} }
pub fn max_token_count(&self) -> usize { pub fn max_token_count(&self) -> usize {
match self { match self {
Model::ThreePointFiveTurbo => 4096, Self::ThreePointFiveTurbo => 4096,
Model::Four => 8192, Self::Four => 8192,
Model::FourTurbo => 128000, Self::FourTurbo => 128000,
Model::FourOmni => 128000, Self::FourOmni => 128000,
Model::Custom { max_tokens, .. } => *max_tokens, Self::FourOmniMini => 128000,
Self::Custom { max_tokens, .. } => *max_tokens,
} }
} }
} }