-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathcomplete.ts
More file actions
32 lines (29 loc) · 1.1 KB
/
complete.ts
File metadata and controls
32 lines (29 loc) · 1.1 KB
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
import { z } from "zod";
import { ActionOutput, AgentActionDefinition } from "@/types";
export const CompleteAction = z
.object({
success: z
.boolean()
.describe("Whether the task was completed successfully."),
text: z
.string()
.nullable()
.describe(
"The text to complete the task with, make this answer the ultimate goal of the task. Be sure to include all the information requested in the task in explicit detail."
),
})
.describe("Complete the task, this must be the final action in the sequence");
export type CompleteActionType = z.infer<typeof CompleteAction>;
export const CompleteActionDefinition: AgentActionDefinition = {
type: "complete" as const,
actionParams: CompleteAction,
run: async (): Promise<ActionOutput> => {
return { success: true, message: "Task Complete" };
},
completeAction: async (params: CompleteActionType) => {
return params.text ?? "No response text found";
},
pprintAction: function (params: CompleteActionType): string {
return `Complete task with ${params.success ? "success" : "failure"}`;
},
};