Browse Source

Adds newest OpenAI model support

main
Eric Amodio 1 year ago
parent
commit
d890c2ec54
3 changed files with 30 additions and 11 deletions
  1. +14
    -6
      package.json
  2. +14
    -4
      src/ai/openaiProvider.ts
  3. +2
    -1
      src/quickpicks/aiModelPicker.ts

+ 14
- 6
package.json View File

@ -2852,19 +2852,27 @@
"default": "gpt-3.5-turbo",
"enum": [
"gpt-3.5-turbo",
"gpt-3.5-turbo-16k",
"gpt-3.5-turbo-0301",
"gpt-3.5-turbo-0613",
"gpt-4",
"gpt-4-0314",
"gpt-4-0613",
"gpt-4-32k",
"gpt-4-32k-0314"
"gpt-4-32k-0314",
"gpt-4-32k-0613"
],
"enumDescriptions": [
"GPT 3.5 Turbo",
"GPT 3.5 Turbo (March 1, 2021)",
"GPT 3.5 Turbo 16k",
"GPT 3.5 Turbo (March 1)",
"GPT 3.5 Turbo (June 13)",
"GPT 4",
"GPT 4 (March 14, 2021)",
"GPT 4 (March 14)",
"GPT 4 (June 13)",
"GPT 4 32k",
"GPT 4 32k (March 14, 2021)"
"GPT 4 32k (March 14)",
"GPT 4 32k (June 13)"
],
"markdownDescription": "Specifies the OpenAI model to use for GitLens' experimental AI features",
"scope": "window",
@ -2881,9 +2889,9 @@
],
"enumDescriptions": [
"Claude v1",
"Claude v1 with 100k token context",
"Claude v1 100k",
"Claude Instant v1",
"Claude Instant v1 with 100k token context"
"Claude Instant v1 100k"
],
"markdownDescription": "Specifies the Anthropic model to use for GitLens' experimental AI features",
"scope": "window",

+ 14
- 4
src/ai/openaiProvider.ts View File

@ -206,19 +206,29 @@ async function getApiKey(storage: Storage): Promise {
}
function getMaxCharacters(model: OpenAIModels): number {
if (model === 'gpt-4-32k' || model === 'gpt-4-32k-0314') {
return 43000;
switch (model) {
case 'gpt-4-32k':
case 'gpt-4-32k-0314':
case 'gpt-4-32k-0613':
return 43000;
case 'gpt-3.5-turbo-16k':
return 21000;
default:
return 12000;
}
return 12000;
}
export type OpenAIModels =
| 'gpt-3.5-turbo'
| 'gpt-3.5-turbo-16k'
| 'gpt-3.5-turbo-0301'
| 'gpt-3.5-turbo-0613'
| 'gpt-4'
| 'gpt-4-0314'
| 'gpt-4-0613'
| 'gpt-4-32k'
| 'gpt-4-32k-0314';
| 'gpt-4-32k-0314'
| 'gpt-4-32k-0613';
interface OpenAIChatCompletionRequest {
model: OpenAIModels;

+ 2
- 1
src/quickpicks/aiModelPicker.ts View File

@ -22,8 +22,9 @@ export async function showAIModelPicker(): Promise
const items: (ModelQuickPickItem | QuickPickSeparator)[] = [
{ label: 'OpenAI', kind: QuickPickItemKind.Separator },
{ label: 'OpenAI', description: 'GPT 3.5 Turbo', provider: 'openai', model: 'gpt-3.5-turbo' },
{ label: 'OpenAI', description: 'GPT 3.5 Turbo 16k', provider: 'openai', model: 'gpt-3.5-turbo-16k' },
{ label: 'OpenAI', description: 'GPT 4', provider: 'openai', model: 'gpt-4' },
{ label: 'OpenAI', description: 'GPT 4 33k', provider: 'openai', model: 'gpt-4-32k' },
{ label: 'OpenAI', description: 'GPT 4 32k', provider: 'openai', model: 'gpt-4-32k' },
{ label: 'Anthropic', kind: QuickPickItemKind.Separator },
{ label: 'Anthropic', description: 'Claude v1', provider: 'anthropic', model: 'claude-v1' },
{ label: 'Anthropic', description: 'Claude v1 100k', provider: 'anthropic', model: 'claude-v1-100k' },

Loading…
Cancel
Save