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

Default System Prompt for Different Models #3690

Closed
wants to merge 7 commits into from
Closed
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
5 changes: 5 additions & 0 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export const Google = {

export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
export const DEFAULT_SYSTEM_TEMPLATE = `
You are a helpful assistant.
Current model: {{model}}
Current time: {{time}}
`;
export const CHATGPT_SYSTEM_TEMPLATE = `
You are ChatGPT, a large language model trained by OpenAI.
Knowledge cutoff: {{cutoff}}
Current model: {{model}}
Expand Down
7 changes: 3 additions & 4 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createEmptyMask, Mask } from "./mask";
import {
DEFAULT_INPUT_TEMPLATE,
DEFAULT_SYSTEM_TEMPLATE,
CHATGPT_SYSTEM_TEMPLATE,
KnowledgeCutOffDate,
ModelProvider,
StoreKey,
Expand Down Expand Up @@ -386,9 +387,7 @@ export const useChatStore = createPersistStore(
const contextPrompts = session.mask.context.slice();

// system prompts, to get close to OpenAI Web ChatGPT
const shouldInjectSystemPrompts =
modelConfig.enableInjectSystemPrompts &&
session.mask.modelConfig.model.startsWith("gpt-");
const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts;

var systemPrompts: ChatMessage[] = [];
systemPrompts = shouldInjectSystemPrompts
Expand All @@ -397,7 +396,7 @@ export const useChatStore = createPersistStore(
role: "system",
content: fillTemplateWith("", {
...modelConfig,
template: DEFAULT_SYSTEM_TEMPLATE,
template: modelConfig.model.startsWith('gpt') ? CHATGPT_SYSTEM_TEMPLATE : DEFAULT_SYSTEM_TEMPLATE,
}),
}),
]
Expand Down
Loading