Skip to content

Commit

Permalink
Support for new models
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzchen committed Jun 13, 2023
1 parent 0bc69f1 commit 5aa2f83
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChatGPT Quick Actions Changelog

## 2023-06-13

- Adds support for the following models: `gpt-3.5-turbo-16k`, `gpt-4-32k-0613`.

## 2023-06-03

- Allows custom model for each command
Expand Down
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
]
}
Expand Down Expand Up @@ -78,9 +86,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
]
}
Expand Down Expand Up @@ -116,9 +132,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
]
}
Expand Down Expand Up @@ -154,9 +178,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
]
}
Expand Down Expand Up @@ -184,9 +216,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
]
}
Expand Down Expand Up @@ -214,9 +254,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
]
}
Expand Down Expand Up @@ -246,9 +294,17 @@
"title": "GPT-3.5 Turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "GPT-3.5 Turbo (16K)",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "GPT-4",
"value": "gpt-4"
},
{
"title": "GPT-4 (32K, 0613)",
"value": "gpt-4-32k-0613"
}
],
"required": true,
Expand Down
10 changes: 8 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ export function countToken(content: string) {

export function estimatePrice(prompt_token: number, output_token: number, model: string) {
// price is per 1K tokens, but we are measuing in cents. Hence the denominator is 10
let price = 0;
if (model == "gpt-3.5-turbo") {
return naiveRound(((prompt_token + output_token) * 0.002) / 10, 2);
price = (prompt_token * 0.0015 + output_token * 0.002) / 10;
} else if (model == "gpt-3.5-turbo-16k") {
price = (prompt_token * 0.003 + output_token * 0.004) / 10;
} else if (model == "gpt-4") {
return naiveRound((prompt_token * 0.03 + output_token * 0.06) / 10, 2);
price = (prompt_token * 0.03 + output_token * 0.06) / 10;
} else if (model == "gpt-4-32k-0613") {
price = (prompt_token * 0.03 + output_token * 0.06) / 10;
} else {
return -1;
}
return naiveRound(price, 2);
}

export async function runAppleScriptSilently(appleScript: string) {
Expand Down

0 comments on commit 5aa2f83

Please sign in to comment.