diff options
| author | A.J. Shulman <Shulman.aj@gmail.com> | 2024-09-07 12:43:05 -0400 |
|---|---|---|
| committer | A.J. Shulman <Shulman.aj@gmail.com> | 2024-09-07 12:43:05 -0400 |
| commit | 4791cd23af08da70895204a3a7fbaf889d9af2d5 (patch) | |
| tree | c4c2534e64724d62bae9152763f1a74cd5a963e0 /src/client/views/nodes/chatbot/tools/BaseTool.ts | |
| parent | 210f8f5f1cd19e9416a12524cce119b273334fd3 (diff) | |
completely restructured, added comments, and significantly reduced the length of the prompt (~72% shorter and cheaper)
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..b57f1c8e4 --- /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, any> = Record<string, any>> implements Tool<T> { + constructor( + public name: string, + public description: string, + public parameters: Record<string, any>, + public citationRules: string, + public briefSummary: string + ) {} + + abstract execute(args: T): Promise<any>; + + getActionRule(): Record<string, any> { + return { + [this.name]: { + name: this.name, + citationRules: this.citationRules, + description: this.description, + parameters: this.parameters, + }, + }; + } +} |
