forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsampleEvalutor.ts
47 lines (45 loc) · 1.66 KB
/
sampleEvalutor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Evaluator, IAgentRuntime, Memory, State, elizaLogger } from "@ai16z/eliza";
export const sampleEvaluator: Evaluator = {
alwaysRun: false,
description: "Sample evaluator for checking important content in memory",
similes: ["content checker", "memory evaluator"],
examples: [
{
context: "Checking if memory contains important content",
messages: [
{
action: "evaluate",
input: "This is an important message",
output: {
score: 1,
reason: "Memory contains important content."
}
}
],
outcome: "Memory should be evaluated as important"
}
],
handler: async (runtime: IAgentRuntime, memory: Memory, state: State) => {
// Evaluation logic for the evaluator
elizaLogger.log("Evaluating data in sampleEvaluator...");
// Example evaluation logic
if (memory.content && memory.content.includes("important")) {
elizaLogger.log("Important content found in memory.");
return {
score: 1,
reason: "Memory contains important content."
};
} else {
elizaLogger.log("No important content found in memory.");
return {
score: 0,
reason: "Memory does not contain important content."
};
}
},
name: "sampleEvaluator",
validate: async (runtime: IAgentRuntime, memory: Memory, state: State) => {
// Validation logic for the evaluator
return true;
}
};