diff --git a/packages/spike/src/ai.ts b/packages/spike/src/ai.ts index 7b5ee53..4fa7b20 100644 --- a/packages/spike/src/ai.ts +++ b/packages/spike/src/ai.ts @@ -73,7 +73,7 @@ const guardrailAgent = new Agent({ const responseGuardrail: InputGuardrail = { name: "'Should Reply' guardrail", execute: async ({ input, context }) => { - const result = await run(guardrailAgent, input.slice(-10), { context }) + const result = await run(guardrailAgent, input.slice(-4), { context }) return { outputInfo: result.finalOutput, diff --git a/packages/spike/src/instructions.ts b/packages/spike/src/instructions.ts index 32ea58c..5a99829 100644 --- a/packages/spike/src/instructions.ts +++ b/packages/spike/src/instructions.ts @@ -133,61 +133,62 @@ user: I got the job! } export const shouldReplyInstructions = () => ` -This is a simple guardrail that checks if Spike should respond to a message in a Discord channel. +You are deciding if Spike, a bot, should respond to a message in a Discord channel. Return 1 if the message is addressed to Spike or expects a response from Spike. Return 0 otherwise. -Two users (Corey and Chris) are in a discord channel with Spike. **You decide if Corey or Chris are expecting a response response from Spike**. - -Usually if Spike is mentioned or asked a question he should reply. If the user is talking about Spike in the third person, Spike should not reply. - -If Spike should reply return 1. -If Spike should not reply return 0. +If the message mentions these nicknames (or variations on these names) treat them as referring to Spike: +- The cactus +- Mr. Cactus +- Spiky ## Nicknames -Spike is often referred to by the following nicknames, consider these when deciding if Spike should reply: -- Spike -- spike +If the user references these names (or variations on these) assume the user is talking about spike + - The cactus +- Mr. Cactus - Spiky ## Example interactions user: Spike, can you set a reminder for me tomorrow at 08:00am for a meeting with the team? - 1 - ------- - -user: I think spike needs to be updated, he responds to everything I say. - 0 +1 ------ user: spike? - 1 +1 ------ user: Spike! - 1 +1 ------ user: Spike, should I run this migration script on production, I haven't really tested it? - 1 - ------- - -user: Is spike being weird? - 0 - ------- - -user: I thought spike would be more helpful with that. - 0 +1 ------ user: hey spike, what up - 1 +1 +------ +user: What do I love spike? +1 + +------ + +user: Is spike being weird? +0 + +------ + +user: I thought spike would be more helpful with that. +0 + +------ + +user: I think spike needs to be updated, he responds to everything I say. +0 `