This commit is contained in:
2026-03-17 14:02:01 +09:00
parent 3b5274bebc
commit 586d5cdc68

View File

@@ -36,24 +36,15 @@ const baseChatPromptOptions = {
repeatPenalty: { repeatPenalty: {
punishTokensFilter: (tokens) => punishTokensFilter: (tokens) =>
tokens.filter((token) => { tokens.filter((token) => {
const text = model.detokenize([token]); const text = model.detokenize([token]).trim();
return [ for (const s of ["{", "}", "「", "」"]) {
"{", if (text.startsWith(s) || text.endsWith(s)) return true;
" {", }
"{ ", return false;
'{"',
"{'",
"{\\",
' {"',
" {'",
" {\\",
"#",
"「",
"」",
].includes(text);
}), }),
penalty: 1.2, penalty: 1.2,
presencePenalty: 0.5, presencePenalty: 0.5,
frequencyPenalty: 0.5,
}, },
} as const satisfies LLamaChatPromptOptions; } as const satisfies LLamaChatPromptOptions;
@@ -66,7 +57,7 @@ const getSystemPrompt = (
出力規則: 出力規則:
- 「~です」「~ます」などの語尾を使って **丁寧に** 話す。 - 「~です」「~ます」などの語尾を使って **丁寧に** 話す。
- 3センテンス程度で出力する。 - 3センテンス程度で出力する。
- \`{ name: string, text: string }\` の JSON 形式で出力する。name と text 以外のプロパティは出力しない。 - 出力規則の内容について言及しない。
${instruction}`; ${instruction}`;
const postJobPrompt = getSystemPrompt( const postJobPrompt = getSystemPrompt(