Skip to content

Commit

Permalink
Add chatgpt-4o-latest
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Lau <[email protected]>
  • Loading branch information
AurevoirXavier committed Aug 15, 2024
1 parent a83d712 commit e5d3589
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/component/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl OpenAi {
pub enum Model {
Custom(String),
Gpt4o,
Gpt4oLatest,
Gpt4oMini,
Gpt4Turbo,
Gpt35Turbo,
Expand All @@ -70,6 +71,7 @@ impl Model {
match self {
Self::Custom(s) => s,
Self::Gpt4o => "gpt-4o",
Self::Gpt4oLatest => "chatgpt-4o-latest",
Self::Gpt4oMini => "gpt-4o-mini",
Self::Gpt4Turbo => "gpt-4-turbo",
Self::Gpt35Turbo => "gpt-3.5-turbo",
Expand All @@ -79,7 +81,7 @@ impl Model {
pub fn prices(&self) -> (f32, f32) {
match self {
Self::Custom(_) => (0., 0.),
Self::Gpt4o => (0.000005, 0.000015),
Self::Gpt4o | Self::Gpt4oLatest => (0.000005, 0.000015),
Self::Gpt4oMini => (0.00000015, 0.0000006),
Self::Gpt4Turbo => (0.00001, 0.00003),
Self::Gpt35Turbo => (0.0000005, 0.0000015),
Expand All @@ -94,16 +96,24 @@ impl Default for Model {
impl ComboBoxItem for Model {
type Array = [Self; Self::COUNT];

const COUNT: usize = 5;
const COUNT: usize = 6;

fn all() -> Self::Array {
[Self::Custom("".into()), Self::Gpt4o, Self::Gpt4oMini, Self::Gpt4Turbo, Self::Gpt35Turbo]
[
Self::Custom("".into()),
Self::Gpt4o,
Self::Gpt4oLatest,
Self::Gpt4oMini,
Self::Gpt4Turbo,
Self::Gpt35Turbo,
]
}

fn selectable_str(&self) -> Cow<str> {
match self {
Self::Custom(_) => "Custom",
Self::Gpt4o => "GPT-4o",
Self::Gpt4oLatest => "GPT-4o Latest",
Self::Gpt4oMini => "GPT-4o Mini",
Self::Gpt4Turbo => "GPT-4 Turbo",
Self::Gpt35Turbo => "GPT-3.5 Turbo",
Expand Down

0 comments on commit e5d3589

Please sign in to comment.