aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/tools/BaseTool.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/ChatBox/tools/BaseTool.ts')
-rw-r--r--src/client/views/nodes/ChatBox/tools/BaseTool.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/client/views/nodes/ChatBox/tools/BaseTool.ts b/src/client/views/nodes/ChatBox/tools/BaseTool.ts
new file mode 100644
index 000000000..2e2267653
--- /dev/null
+++ b/src/client/views/nodes/ChatBox/tools/BaseTool.ts
@@ -0,0 +1,24 @@
+import { Tool } from '../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,
+ },
+ };
+ }
+}