support custom tools (#2668)
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import { Plugin } from "./index"
|
||||
import { tool } from "./tool"
|
||||
|
||||
export const ExamplePlugin: Plugin = async ({
|
||||
client: _client,
|
||||
$: _shell,
|
||||
project: _project,
|
||||
directory: _directory,
|
||||
worktree: _worktree,
|
||||
}) => {
|
||||
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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user