aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/BaseTool.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-10-10 19:04:57 -0400
committerbobzel <zzzman@gmail.com>2024-10-10 19:04:57 -0400
commit3a35e2687e3c7b0c864dd4f00b1002ff088b56d3 (patch)
tree98697432c5be99a0e1b64cc42eff9e7a0ec58457 /src/client/views/nodes/chatbot/tools/BaseTool.ts
parentf75f15ae58b57644c28d42446c176289bbe55dd4 (diff)
parentd347fc59feefd91a796012892da57511787bb6d0 (diff)
merged with master
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/BaseTool.ts')
-rw-r--r--src/client/views/nodes/chatbot/tools/BaseTool.ts32
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,
+ },
+ };
+ }
+}