Better one-shot for should respond

This commit is contained in:
Corey Johnson 2025-06-18 09:59:38 -07:00
parent 9976bde4de
commit 880779e659
2 changed files with 32 additions and 31 deletions

View File

@ -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,

View File

@ -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?
<respond> 1
------
user: I think spike needs to be updated, he responds to everything I say.
<respond> 0
1
------
user: spike?
<respond> 1
1
------
user: Spike!
<respond> 1
1
------
user: Spike, should I run this migration script on production, I haven't really tested it?
<respond> 1
------
user: Is spike being weird?
<respond> 0
------
user: I thought spike would be more helpful with that.
<respond> 0
1
------
user: hey spike, what up
<respond> 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
`