diff --git a/front/components/assistant_builder/AssistantBuilder.tsx b/front/components/assistant_builder/AssistantBuilder.tsx index be7554ac57b7..889c6cbf4b16 100644 --- a/front/components/assistant_builder/AssistantBuilder.tsx +++ b/front/components/assistant_builder/AssistantBuilder.tsx @@ -41,7 +41,7 @@ import { CLAUDE_DEFAULT_MODEL_CONFIG, CLAUDE_INSTANT_DEFAULT_MODEL_CONFIG, getSupportedModelConfig, - GPT_3_5_TURBO_16K_MODEL_CONFIG, + GPT_3_5_TURBO_MODEL_CONFIG, GPT_4_TURBO_MODEL_CONFIG, MISTRAL_7B_DEFAULT_MODEL_CONFIG, SupportedModel, @@ -67,7 +67,7 @@ import DustAppSelectionSection from "./DustAppSelectionSection"; const usedModelConfigs = [ GPT_4_TURBO_MODEL_CONFIG, - GPT_3_5_TURBO_16K_MODEL_CONFIG, + GPT_3_5_TURBO_MODEL_CONFIG, CLAUDE_DEFAULT_MODEL_CONFIG, CLAUDE_INSTANT_DEFAULT_MODEL_CONFIG, MISTRAL_7B_DEFAULT_MODEL_CONFIG, @@ -228,7 +228,7 @@ export default function AssistantBuilder({ ...DEFAULT_ASSISTANT_STATE.generationSettings, modelSettings: plan.code === FREE_TEST_PLAN_CODE - ? GPT_3_5_TURBO_16K_MODEL_CONFIG + ? GPT_3_5_TURBO_MODEL_CONFIG : GPT_4_TURBO_MODEL_CONFIG, }, }); diff --git a/front/lib/api/assistant/agent.ts b/front/lib/api/assistant/agent.ts index 73c3be330bb1..a11be5383d29 100644 --- a/front/lib/api/assistant/agent.ts +++ b/front/lib/api/assistant/agent.ts @@ -14,7 +14,7 @@ import { runGeneration, } from "@app/lib/api/assistant/generation"; import { - GPT_3_5_TURBO_16K_MODEL_CONFIG, + GPT_3_5_TURBO_MODEL_CONFIG, GPT_4_32K_MODEL_CONFIG, GPT_4_MODEL_CONFIG, GPT_4_TURBO_MODEL_CONFIG, @@ -71,8 +71,8 @@ export async function generateActionInputs( let model: { providerId: string; modelId: string } = isFree ? { - providerId: GPT_3_5_TURBO_16K_MODEL_CONFIG.providerId, - modelId: GPT_3_5_TURBO_16K_MODEL_CONFIG.modelId, + providerId: GPT_3_5_TURBO_MODEL_CONFIG.providerId, + modelId: GPT_3_5_TURBO_MODEL_CONFIG.modelId, } : { providerId: GPT_4_TURBO_MODEL_CONFIG.providerId, @@ -80,7 +80,7 @@ export async function generateActionInputs( }; const contextSize = isFree - ? GPT_3_5_TURBO_16K_MODEL_CONFIG.contextSize + ? GPT_3_5_TURBO_MODEL_CONFIG.contextSize : GPT_4_TURBO_MODEL_CONFIG.contextSize; // Turn the conversation into a digest that can be presented to the model. diff --git a/front/lib/api/assistant/conversation.ts b/front/lib/api/assistant/conversation.ts index 3b2823c0b460..bb30b5d9fc98 100644 --- a/front/lib/api/assistant/conversation.ts +++ b/front/lib/api/assistant/conversation.ts @@ -21,7 +21,7 @@ import { GenerationTokensEvent, renderConversationForModel, } from "@app/lib/api/assistant/generation"; -import { GPT_3_5_TURBO_16K_MODEL_CONFIG } from "@app/lib/assistant"; +import { GPT_3_5_TURBO_MODEL_CONFIG } from "@app/lib/assistant"; import { Authenticator } from "@app/lib/auth"; import { front_sequelize } from "@app/lib/databases"; import { @@ -554,8 +554,8 @@ export async function generateConversationTitle( conversation: ConversationType ): Promise> { const model = { - providerId: GPT_3_5_TURBO_16K_MODEL_CONFIG.providerId, - modelId: GPT_3_5_TURBO_16K_MODEL_CONFIG.modelId, + providerId: GPT_3_5_TURBO_MODEL_CONFIG.providerId, + modelId: GPT_3_5_TURBO_MODEL_CONFIG.modelId, }; const allowedTokenCount = 12288; // for 16k model. diff --git a/front/lib/api/assistant/global_agents.ts b/front/lib/api/assistant/global_agents.ts index d21e252e5311..79c5f233c1a8 100644 --- a/front/lib/api/assistant/global_agents.ts +++ b/front/lib/api/assistant/global_agents.ts @@ -7,7 +7,6 @@ const readFileAsync = promisify(fs.readFile); import { CLAUDE_DEFAULT_MODEL_CONFIG, CLAUDE_INSTANT_DEFAULT_MODEL_CONFIG, - GPT_3_5_TURBO_16K_MODEL_CONFIG, GPT_3_5_TURBO_MODEL_CONFIG, GPT_4_TURBO_MODEL_CONFIG, MISTRAL_7B_DEFAULT_MODEL_CONFIG, @@ -115,10 +114,8 @@ async function _getHelperGlobalAgent( } async function _getGPT35TurboGlobalAgent({ - plan, settings, }: { - plan: PlanType; settings: GlobalAgentSettings | null; }): Promise { return { @@ -134,16 +131,10 @@ async function _getGPT35TurboGlobalAgent({ generation: { id: -1, prompt: "", - model: - plan.code === FREE_TEST_PLAN_CODE - ? { - providerId: GPT_3_5_TURBO_MODEL_CONFIG.providerId, - modelId: GPT_3_5_TURBO_MODEL_CONFIG.modelId, - } - : { - providerId: GPT_3_5_TURBO_16K_MODEL_CONFIG.providerId, - modelId: GPT_3_5_TURBO_16K_MODEL_CONFIG.modelId, - }, + model: { + providerId: GPT_3_5_TURBO_MODEL_CONFIG.providerId, + modelId: GPT_3_5_TURBO_MODEL_CONFIG.modelId, + }, temperature: 0.7, }, action: null, @@ -592,7 +583,7 @@ export async function getGlobalAgent( agentConfiguration = await _getHelperGlobalAgent(auth); break; case GLOBAL_AGENTS_SID.GPT35_TURBO: - agentConfiguration = await _getGPT35TurboGlobalAgent({ settings, plan }); + agentConfiguration = await _getGPT35TurboGlobalAgent({ settings }); break; case GLOBAL_AGENTS_SID.GPT4: agentConfiguration = await _getGPT4GlobalAgent({ plan }); diff --git a/front/lib/assistant.ts b/front/lib/assistant.ts index dfcbafe828d1..51b55f955a8b 100644 --- a/front/lib/assistant.ts +++ b/front/lib/assistant.ts @@ -8,6 +8,7 @@ import { AgentConfigurationType } from "@app/types/assistant/agent"; export const GPT_4_32K_MODEL_ID = "gpt-4-32k" as const; export const GPT_4_MODEL_ID = "gpt-4" as const; export const GPT_4_TURBO_MODEL_ID = "gpt-4-1106-preview" as const; +export const GPT_3_5_TURBO_MODEL_ID = "gpt-3.5-turbo-1106" as const; export const GPT_4_32K_MODEL_CONFIG = { providerId: "openai", @@ -36,20 +37,11 @@ export const GPT_4_TURBO_MODEL_CONFIG = { largeModel: true, } as const; -export const GPT_3_5_TURBO_16K_MODEL_CONFIG = { - providerId: "openai", - modelId: "gpt-3.5-turbo-16k", - displayName: "GPT 3.5 Turbo", - contextSize: 16384, - recommendedTopK: 16, - largeModel: false, -} as const; - export const GPT_3_5_TURBO_MODEL_CONFIG = { providerId: "openai", - modelId: "gpt-3.5-turbo", + modelId: GPT_3_5_TURBO_MODEL_ID, displayName: "GPT 3.5 Turbo", - contextSize: 4096, + contextSize: 16384, recommendedTopK: 16, largeModel: false, } as const; @@ -82,7 +74,6 @@ export const MISTRAL_7B_DEFAULT_MODEL_CONFIG = { } as const; export const SUPPORTED_MODEL_CONFIGS = [ - GPT_3_5_TURBO_16K_MODEL_CONFIG, GPT_3_5_TURBO_MODEL_CONFIG, GPT_4_32K_MODEL_CONFIG, GPT_4_MODEL_CONFIG, diff --git a/front/migrations/20231113_migrate_assistants_to_gpt4_turbo.ts b/front/migrations/20231113_migrate_assistants_models.ts similarity index 79% rename from front/migrations/20231113_migrate_assistants_to_gpt4_turbo.ts rename to front/migrations/20231113_migrate_assistants_models.ts index e52de58a1c11..4301f0473b71 100644 --- a/front/migrations/20231113_migrate_assistants_to_gpt4_turbo.ts +++ b/front/migrations/20231113_migrate_assistants_models.ts @@ -1,3 +1,7 @@ +import { + GPT_3_5_TURBO_MODEL_ID, + // GPT_4_TURBO_MODEL_ID, +} from "@app/lib/assistant"; import { AgentConfiguration, AgentGenerationConfiguration, @@ -7,6 +11,14 @@ import { Err } from "@app/lib/result"; const { LIVE, WORKSPACE } = process.env; +// GPT-4 and GPT-4-32k are being replaced by GPT-4-1106-preview +// const FROM_MODELS = ["gpt-4", "gpt-4-32k"]; +// const TO_MODEL = GPT_4_TURBO_MODEL_ID; + +// GPT-3.5 Turbo and GPT-3.5 Turbo 16k are being replaced by GPT-3.5 Turbo 1106 +const FROM_MODELS = ["gpt-3.5-turbo", "gpt-3.5-turbo-16k"]; +const TO_MODEL = GPT_3_5_TURBO_MODEL_ID; + async function updateWorkspaceAssistants(wId: string) { // console.log(`Updating agents for workspace ${wId}...`); @@ -39,10 +51,10 @@ async function updateWorkspaceAssistants(wId: string) { ); } - if (g.modelId === "gpt-4" || g.modelId === "gpt-4-32k") { + if (FROM_MODELS.includes(g.modelId)) { if (LIVE) { const oldModel = g.modelId; - await g.update({ modelId: "gpt-4-1106-preview" }); + await g.update({ modelId: TO_MODEL }); console.log("Updated", c.sId, c.name, "from " + oldModel); } else { console.log("Would update", c.sId, c.name, "from " + g.modelId);