example.ts 486 B

12345678910111213141516171819202122
  1. import { Plugin } from "./index"
  2. import { tool } from "./tool"
  3. export const ExamplePlugin: Plugin = async (ctx) => {
  4. return {
  5. permission: {},
  6. tool: {
  7. mytool: tool({
  8. description: "This is a custom tool tool",
  9. args: {
  10. foo: tool.schema.string().describe("foo"),
  11. },
  12. async execute(args) {
  13. return `Hello ${args.foo}!`
  14. },
  15. }),
  16. },
  17. async "chat.params"(_input, output) {
  18. output.topP = 1
  19. },
  20. }
  21. }