aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/BaseTool.ts
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-10-17 11:14:51 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-10-17 11:14:51 -0400
commit14f412611299fc350f13b6f96be913d59533cfb3 (patch)
tree79e05a3467a44b5a3a5db5baaec2febce72a2526 /src/client/views/nodes/chatbot/tools/BaseTool.ts
parent80d86bd5ae3e1d3dc70e7636f72a872a5fb2f01d (diff)
Removed awaits inside loops and made Parameters readonly for better type safety
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/BaseTool.ts')
-rw-r--r--src/client/views/nodes/chatbot/tools/BaseTool.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/views/nodes/chatbot/tools/BaseTool.ts b/src/client/views/nodes/chatbot/tools/BaseTool.ts
index e01296ac4..58cd514d9 100644
--- a/src/client/views/nodes/chatbot/tools/BaseTool.ts
+++ b/src/client/views/nodes/chatbot/tools/BaseTool.ts
@@ -1,4 +1,5 @@
-import { Tool, Parameter, ParametersType, Observation } from '../types/types';
+import { Observation } from '../types/types';
+import { Parameter, Tool, ParametersType } from './ToolTypes';
/**
* @file BaseTool.ts
@@ -10,10 +11,10 @@ import { Tool, Parameter, ParametersType, Observation } from '../types/types';
/**
* The `BaseTool` class is an abstract class that implements the `Tool` interface.
- * It is generic over a type parameter `P`, which extends `readonly Parameter[]`.
- * This means `P` is an array of `Parameter` objects that cannot be modified (immutable).
+ * It is generic over a type parameter `P`, which extends `ReadonlyArray<Parameter>`.
+ * This means `P` is a readonly array of `Parameter` objects that cannot be modified (immutable).
*/
-export abstract class BaseTool<P extends readonly Parameter[]> implements Tool<P> {
+export abstract class BaseTool<P extends ReadonlyArray<Parameter>> implements Tool<P> {
// The name of the tool (e.g., "calculate", "searchTool")
name: string;
// A description of the tool's functionality
@@ -29,7 +30,7 @@ export abstract class BaseTool<P extends readonly Parameter[]> implements Tool<P
* Constructs a new `BaseTool` instance.
* @param name - The name of the tool.
* @param description - A detailed description of what the tool does.
- * @param parameterRules - An array of parameter definitions (`Parameter[]`).
+ * @param parameterRules - A readonly array of parameter definitions (`ReadonlyArray<Parameter>`).
* @param citationRules - Rules or guidelines for citations.
* @param briefSummary - A short summary of the tool.
*/