aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/CalculateTool.ts
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-12-18 11:46:14 -0500
committerA.J. Shulman <Shulman.aj@gmail.com>2024-12-18 11:46:14 -0500
commitad1e0cf62187e0f8bbb19b4720b7681585361de9 (patch)
tree673dd63ddc1808e6e89dab5021c2136cbbe843c8 /src/client/views/nodes/chatbot/tools/CalculateTool.ts
parent9e447814b551c352709296ae562f1f50480320f5 (diff)
better
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/CalculateTool.ts')
-rw-r--r--src/client/views/nodes/chatbot/tools/CalculateTool.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/client/views/nodes/chatbot/tools/CalculateTool.ts b/src/client/views/nodes/chatbot/tools/CalculateTool.ts
index 139ede8f0..ca7223803 100644
--- a/src/client/views/nodes/chatbot/tools/CalculateTool.ts
+++ b/src/client/views/nodes/chatbot/tools/CalculateTool.ts
@@ -1,5 +1,5 @@
import { Observation } from '../types/types';
-import { ParametersType } from '../types/tool_types';
+import { ParametersType, ToolInfo } from '../types/tool_types';
import { BaseTool } from './BaseTool';
const calculateToolParams = [
@@ -13,15 +13,16 @@ const calculateToolParams = [
type CalculateToolParamsType = typeof calculateToolParams;
+const calculateToolInfo: ToolInfo<CalculateToolParamsType> = {
+ name: 'calculate',
+ citationRules: 'No citation needed.',
+ parameterRules: calculateToolParams,
+ description: 'Runs a calculation and returns the number - uses JavaScript so be sure to use floating point syntax if necessary',
+};
+
export class CalculateTool extends BaseTool<CalculateToolParamsType> {
constructor() {
- super(
- 'calculate',
- 'Perform a calculation',
- calculateToolParams, // Use the reusable param config here
- 'Provide a mathematical expression to calculate that would work with JavaScript eval().',
- 'Runs a calculation and returns the number - uses JavaScript so be sure to use floating point syntax if necessary'
- );
+ super(calculateToolInfo);
}
async execute(args: ParametersType<CalculateToolParamsType>): Promise<Observation[]> {