summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin/src/example.ts
blob: fd6a404d9edbe742fd1ad1a7fe9f104d14a66c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Plugin } from "./index"
import { tool } from "./tool"

export const ExamplePlugin: Plugin = async (ctx) => {
  return {
    permission: {},
    tool: {
      mytool: tool((zod) => ({
        description: "This is a custom tool tool",
        args: {
          foo: zod.string(),
        },
        async execute(args, ctx) {
          return `Hello ${args.foo}!`
        },
      })),
    },
    async "chat.params"(_input, output) {
      output.topP = 1
    },
  }
}