diff options
| author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-10-10 19:30:06 -0400 |
|---|---|---|
| committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-10-10 19:30:06 -0400 |
| commit | 373340938a4bc48edb4b9345f28e562de41153d6 (patch) | |
| tree | d6604992d93a12920e1b62a1f906735d59434765 /src/client/views/nodes/chatbot/tools/BaseTool.ts | |
| parent | 772c7a4c4d8867cbc33a673c3e3c6f3e330d395d (diff) | |
| parent | 5752dff8ff7b1b2858542feec0b1bb037461bf1a (diff) | |
Merge branch 'nathan-starter' of https://github.com/brown-dash/Dash-Web into nathan-starter
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/BaseTool.ts')
| -rw-r--r-- | src/client/views/nodes/chatbot/tools/BaseTool.ts | 32 |
1 files changed, 32 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..a77f567a5 --- /dev/null +++ b/src/client/views/nodes/chatbot/tools/BaseTool.ts @@ -0,0 +1,32 @@ +/** + * @file BaseTool.ts + * @description This file defines the abstract BaseTool class, which serves as a blueprint + * for tool implementations in the AI assistant system. Each tool has a name, description, + * parameters, and citation rules. The BaseTool class provides a structure for executing actions + * and retrieving action rules for use within the assistant's workflow. + */ + +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, + }, + }; + } +} |
