Skip to content

Commit 1305730

Browse files
committed
filter system messages when building prompt
1 parent 8074ead commit 1305730

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/buildPrompt.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export async function buildPrompt({
1111
preprompt,
1212
continueMessage,
1313
}: buildPromptOptions): Promise<string> {
14+
const filteredMessages = messages.filter((m) => m.from !== "system");
15+
1416
let prompt = model
15-
.chatPromptRender({ messages, preprompt })
17+
.chatPromptRender({ messages: filteredMessages, preprompt })
1618
// Not super precise, but it's truncated in the model's backend anyway
1719
.split(" ")
1820
.slice(-(model.parameters?.truncate ?? 0))

0 commit comments

Comments
 (0)