Skip to content

Commit 47a57db

Browse files
HashWarlockwtfsayo
andauthored
fix: make template message footer more explicit (#2774)
Co-authored-by: Sayo <hi@sayo.wtf>
1 parent d505157 commit 47a57db

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/core/src/parsing.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import type { ActionResponse } from "./types.ts";
22
const jsonBlockPattern = /```json\n([\s\S]*?)\n```/;
33

4-
export const messageCompletionFooter = `\nResponse format should be formatted in a JSON block like this:
4+
export const messageCompletionFooter = `\nResponse format should be formatted in a valid JSON block like this:
55
\`\`\`json
6-
{ "user": "{{agentName}}", "text": "string", "action": "string" }
7-
\`\`\``;
6+
{ "user": "{{agentName}}", "text": "<string>", "action": "<string>" }
7+
\`\`\`
8+
9+
The “action” field should be one of the options in [Available Actions] and the "text" field should be the response you want to send.
10+
`;
811

912
export const shouldRespondFooter = `The available options are [RESPOND], [IGNORE], or [STOP]. Choose the most appropriate option.
1013
If {{agentName}} is talking too much, you can choose [IGNORE]
@@ -60,15 +63,15 @@ export const parseBooleanFromText = (text: string) => {
6063
return null; // Return null for unrecognized inputs
6164
};
6265

63-
export const stringArrayFooter = `Respond with a JSON array containing the values in a JSON block formatted for markdown with this structure:
66+
export const stringArrayFooter = `Respond with a JSON array containing the values in a valid JSON block formatted for markdown with this structure:
6467
\`\`\`json
6568
[
6669
'value',
6770
'value'
6871
]
6972
\`\`\`
7073
71-
Your response must include the JSON block.`;
74+
Your response must include the valid JSON block.`;
7275

7376
/**
7477
* Parses a JSON array from a given text. The function looks for a JSON block wrapped in triple backticks

0 commit comments

Comments
 (0)