From c9a3caf1d090a92fe4b35c41ad3281887411e846 Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Tue, 7 Nov 2023 09:05:42 +0100 Subject: [PATCH] feat: add gpt-3.5-turbo-1106 --- src/ai/AIAssistant.ts | 3 ++- src/ai/getModelMaxTokens.ts | 2 ++ src/ai/models.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ai/AIAssistant.ts b/src/ai/AIAssistant.ts index d22ebf3..27a68b5 100644 --- a/src/ai/AIAssistant.ts +++ b/src/ai/AIAssistant.ts @@ -11,9 +11,10 @@ import { makeNoticeHandler } from "./makeNoticeHandler"; import { getModelMaxTokens } from "./getModelMaxTokens"; export const getTokenCount = (text: string, model: Model) => { - // gpt-3.5-turbo-16k is a special case - it isn't in the library list yet. Same with gpt-4-1106-preview. + // gpt-3.5-turbo-16k is a special case - it isn't in the library list yet. Same with gpt-4-1106-preview and gpt-3.5-turbo-1106. let m = model === "gpt-3.5-turbo-16k" ? "gpt-3.5-turbo" : model; m = m === "gpt-4-1106-preview" ? "gpt-4" : m; + m = m === "gpt-3.5-turbo-1106" ? "gpt-3.5-turbo" : m; return encodingForModel(m).encode(text).length; }; diff --git a/src/ai/getModelMaxTokens.ts b/src/ai/getModelMaxTokens.ts index f0652ee..74783d6 100644 --- a/src/ai/getModelMaxTokens.ts +++ b/src/ai/getModelMaxTokens.ts @@ -11,6 +11,8 @@ export function getModelMaxTokens(model: Model) { return 8192; case "gpt-3.5-turbo-16k": return 16384; + case "gpt-3.5-turbo-1106": + return 16385; case "gpt-4-1106-preview": return 128000; case "gpt-4-32k": diff --git a/src/ai/models.ts b/src/ai/models.ts index 0674268..b550f85 100644 --- a/src/ai/models.ts +++ b/src/ai/models.ts @@ -1,4 +1,4 @@ -export const models = ["gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4", "gpt-4-1106-preview", "gpt-4-32k", "text-davinci-003"] as const; +export const models = ["gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-1106", "gpt-4", "gpt-4-1106-preview", "gpt-4-32k", "text-davinci-003"] as const; export const models_and_ask_me = [...models, "Ask me"] as const; export type Model = typeof models[number]; export type Models_And_Ask_Me = typeof models_and_ask_me[number];