mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
e6d70b523e
* feat: add @memoh/agent * chore: use @memoh/agent in @memoh-gateway
28 lines
721 B
TypeScript
28 lines
721 B
TypeScript
import { tool } from 'ai'
|
|
import { z } from 'zod'
|
|
|
|
interface SkillToolParams {
|
|
useSkill: (skill: string) => void
|
|
}
|
|
|
|
export const getSkillTools = ({ useSkill }: SkillToolParams) => {
|
|
const useSkillTool = tool({
|
|
description: 'Use a skill if you think it is relevant to the current task',
|
|
inputSchema: z.object({
|
|
skillName: z.string().describe('The name of the skill to use'),
|
|
reason: z.string().describe('The reason why you think this skill is relevant to the current task'),
|
|
}),
|
|
execute: async ({ skillName, reason }) => {
|
|
useSkill(skillName)
|
|
return {
|
|
success: true,
|
|
skillName,
|
|
reason,
|
|
}
|
|
},
|
|
})
|
|
|
|
return {
|
|
'use_skill': useSkillTool,
|
|
}
|
|
} |