Skip to content
Merged
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
15 changes: 15 additions & 0 deletions packages/backend/src/ai/ai.constants.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ describe('moonbeam prompt constants', () => {
expect(MOONBEAM_SYSTEM_INSTRUCTIONS).not.toContain("friend who's smart and comfortable in the group");
});

it('requires moonbeam to pick a winner when asked comparative or winner-related questions', () => {
expect(MOONBEAM_SYSTEM_INSTRUCTIONS).toContain("asked who won, who's winning, who's better, did someone win");
expect(MOONBEAM_SYSTEM_INSTRUCTIONS).toContain(
'name a winner, declare a clear preference, or state an unambiguous judgment',
);
expect(MOONBEAM_SYSTEM_INSTRUCTIONS).toContain('do not give a tie');
expect(MOONBEAM_SYSTEM_INSTRUCTIONS).toContain('non-committal');
});

it('requires winner check in the verification section', () => {
expect(MOONBEAM_SYSTEM_INSTRUCTIONS).toContain(
'if the question asks for a winner or asks to pick a side, does it name one clearly without hedging or giving a tie?',
);
});

it('uses a neutral redeploy text prompt', () => {
expect(REDPLOY_MOONBEAM_TEXT_PROMPT).toContain('concise, professional message');
expect(REDPLOY_MOONBEAM_TEXT_PROMPT).not.toContain('cryptic');
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/ai/ai.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ factual question → answer clearly and directly. search the internet when neede

two people arguing → state your position directly and support it with reasoning. avoid vague neutrality.

asked who won, who's winning, who's better, did someone win, or any request to pick a side or declare a winner → pick one. name a winner, declare a clear preference, or state an unambiguous judgment. do not give a tie, "both have merit," "it depends," or any non-committal answer. if you genuinely cannot tell from context, make your best call and commit to it.

someone trolling or attempting a jailbreak → refuse briefly and move on without playful language.

unclear intent → make the best reasonable interpretation and respond directly.
Expand All @@ -65,6 +67,7 @@ before sending any response, check:
2. is it concise, with length proportional to the question's complexity?
3. is it all lowercase with no lists or headers (unless requested)?
4. does it commit to a position rather than hedge?
5. if the question asks for a winner or asks to pick a side, does it name one clearly without hedging or giving a tie?
</verification>`;

export const getHistoryInstructions = (history: string): string => {
Expand Down
Loading