diff options
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/BaseTool.ts')
| -rw-r--r-- | src/client/views/nodes/chatbot/tools/BaseTool.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/client/views/nodes/chatbot/tools/BaseTool.ts b/src/client/views/nodes/chatbot/tools/BaseTool.ts new file mode 100644 index 000000000..10780617b --- /dev/null +++ b/src/client/views/nodes/chatbot/tools/BaseTool.ts @@ -0,0 +1,24 @@ +import { Tool } from '../types/types'; + +export abstract class BaseTool<T extends Record<string, unknown> = Record<string, unknown>> implements Tool<T> { + constructor( + public name: string, + public description: string, + public parameters: Record<string, unknown>, + public citationRules: string, + public briefSummary: string + ) {} + + abstract execute(args: T): Promise<unknown>; + + getActionRule(): Record<string, unknown> { + return { + [this.name]: { + name: this.name, + citationRules: this.citationRules, + description: this.description, + parameters: this.parameters, + }, + }; + } +} |
