filter system messages when building prompt
Browse files- src/lib/buildPrompt.ts +3 -1
src/lib/buildPrompt.ts
CHANGED
@@ -11,8 +11,10 @@ export async function buildPrompt({
|
|
11 |
preprompt,
|
12 |
continueMessage,
|
13 |
}: buildPromptOptions): Promise<string> {
|
|
|
|
|
14 |
let prompt = model
|
15 |
-
.chatPromptRender({ messages, preprompt })
|
16 |
// Not super precise, but it's truncated in the model's backend anyway
|
17 |
.split(" ")
|
18 |
.slice(-(model.parameters?.truncate ?? 0))
|
|
|
11 |
preprompt,
|
12 |
continueMessage,
|
13 |
}: buildPromptOptions): Promise<string> {
|
14 |
+
const filteredMessages = messages.filter((m) => m.from !== "system");
|
15 |
+
|
16 |
let prompt = model
|
17 |
+
.chatPromptRender({ messages: filteredMessages, preprompt })
|
18 |
// Not super precise, but it's truncated in the model's backend anyway
|
19 |
.split(" ")
|
20 |
.slice(-(model.parameters?.truncate ?? 0))
|