diff --git a/package.json b/package.json index 79098032e3eb..67d71c1098ce 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "modern-screenshot": "^4", "nanoid": "^5", "next": "^13.5.3", - "openai": "^4.10.0", + "openai": "~4.15.0", "polished": "^4", "posthog-js": "^1", "query-string": "^8", diff --git a/src/const/llm.ts b/src/const/llm.ts index da849775d93f..546906775737 100644 --- a/src/const/llm.ts +++ b/src/const/llm.ts @@ -1,3 +1,5 @@ +import { LanguageModel } from '@/types/llm'; + /** * A white list of language models that are allowed to display and be used in the app. */ @@ -9,9 +11,4 @@ export const LanguageModelWhiteList = [ 'gpt-4-32k', ]; -export const DEFAULT_OPENAI_MODEL_LIST = [ - 'gpt-3.5-turbo', - 'gpt-3.5-turbo-16k', - 'gpt-4', - 'gpt-4-32k', -]; +export const DEFAULT_OPENAI_MODEL_LIST: string[] = Object.values(LanguageModel); diff --git a/src/const/modelTokens.ts b/src/const/modelTokens.ts index b84e20afda96..082e4f643869 100644 --- a/src/const/modelTokens.ts +++ b/src/const/modelTokens.ts @@ -1,8 +1,12 @@ import { LanguageModel } from '@/types/llm'; +// refs to: https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo export const ModelTokens: Record = { [LanguageModel.GPT3_5]: 4096, - [LanguageModel.GPT3_5_16K]: 4096 * 4, + [LanguageModel.GPT3_5_1106]: 16_385, + [LanguageModel.GPT3_5_16K]: 16_385, [LanguageModel.GPT4]: 8196, - [LanguageModel.GPT4_32K]: 8196 * 4, + [LanguageModel.GPT4_PREVIEW]: 128_000, + [LanguageModel.GPT4_VISION_PREVIEW]: 128_000, + [LanguageModel.GPT4_32K]: 32_768, }; diff --git a/src/types/llm.ts b/src/types/llm.ts index 3a2d8628fa84..6fc4a8a3ac67 100644 --- a/src/types/llm.ts +++ b/src/types/llm.ts @@ -6,12 +6,15 @@ export enum LanguageModel { * GPT 3.5 Turbo */ GPT3_5 = 'gpt-3.5-turbo', + GPT3_5_1106 = 'gpt-3.5-turbo-1106', GPT3_5_16K = 'gpt-3.5-turbo-16k', /** * GPT 4 */ GPT4 = 'gpt-4', GPT4_32K = 'gpt-4-32k', + GPT4_PREVIEW = 'gpt-4-1106-preview', + GPT4_VISION_PREVIEW = 'gpt-4-vision-preview', } // 语言模型的设置参数