Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat Models [GPT-4] [GPT-3.5] [128K context] #3143

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ export const OpenaiPath = {
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
export const DEFAULT_SYSTEM_TEMPLATE = `
You are ChatGPT, a large language model trained by OpenAI.
Knowledge cutoff: 2021-09
Knowledge cutoff: {{knowledgeCutoff}}
Current model: {{model}}
Current time: {{time}}`;
Current time: {{time}}
`;

export const SUMMARIZE_MODEL = "gpt-3.5-turbo";

Expand Down Expand Up @@ -100,6 +101,14 @@ export const DEFAULT_MODELS = [
name: "gpt-4-32k-0613",
available: true,
},
{
name: "gpt-4-1106-preview",
available: true,
},
{
name: "gpt-4-vision-preview",
available: true,
},
{
name: "gpt-3.5-turbo",
available: true,
Expand All @@ -112,6 +121,10 @@ export const DEFAULT_MODELS = [
name: "gpt-3.5-turbo-0613",
available: true,
},
{
name: "gpt-3.5-turbo-1106",
available: true,
},
{
name: "gpt-3.5-turbo-16k",
available: true,
Expand Down
34 changes: 19 additions & 15 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,22 +401,26 @@ export const useChatStore = createPersistStore(

// system prompts, to get close to OpenAI Web ChatGPT
const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts;
const systemPrompts = shouldInjectSystemPrompts
? [
createMessage({
role: "system",
content: fillTemplateWith("", {
...modelConfig,
template: DEFAULT_SYSTEM_TEMPLATE,
}),
}),
]
: [];
let systemPrompts = shouldInjectSystemPrompts ? [] : [];

if (shouldInjectSystemPrompts) {
console.log(
"[Global System Prompt] ",
systemPrompts.at(0)?.content ?? "empty",
);
const model = modelConfig.model;
let systemTemplate = DEFAULT_SYSTEM_TEMPLATE;

if (model === "gpt-4-1106-preview" || model === "gpt-4-vision-preview") {
systemTemplate = systemTemplate.replace("{{knowledgeCutoff}}", "2023-04");
} else {
systemTemplate = systemTemplate.replace("{{knowledgeCutoff}}", "2021-09");
}

const systemPrompt = createMessage({
role: "system",
content: fillTemplateWith("", {
...modelConfig,
template: systemTemplate,
}),
});
console.log("[Global System Prompt] ", systemPrompt.content);
}

// long term memory
Expand Down