aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/dynamic
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2025-06-11 13:22:58 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2025-06-11 13:22:58 -0400
commitccfdf905400cd4b81d8cde0f16bb0e15cd65621b (patch)
treeea32d8a59df4f3875d71d4e10f91b867132f4229 /src/client/views/nodes/chatbot/tools/dynamic
parent656dbe6dc64013215eb312173df398fe4606d788 (diff)
improved agent tool generation
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/dynamic')
-rw-r--r--src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts33
-rw-r--r--src/client/views/nodes/chatbot/tools/dynamic/InspirationalQuotesTool.ts39
2 files changed, 39 insertions, 33 deletions
diff --git a/src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts b/src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts
deleted file mode 100644
index 38fed231c..000000000
--- a/src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Observation } from '../../types/types';
-import { ParametersType, ToolInfo } from '../../types/tool_types';
-import { BaseTool } from '../BaseTool';
-
-const characterCountParams = [
- {
- name: 'text',
- type: 'string',
- description: 'The text to count characters in',
- required: true
- }
- ] as const;
-
- type CharacterCountParamsType = typeof characterCountParams;
-
- const characterCountInfo: ToolInfo<CharacterCountParamsType> = {
- name: 'charactercount',
- description: 'Counts characters in text, excluding spaces',
- citationRules: 'No citation needed.',
- parameterRules: characterCountParams
- };
-
- export class CharacterCountTool extends BaseTool<CharacterCountParamsType> {
- constructor() {
- super(characterCountInfo);
- }
-
- async execute(args: ParametersType<CharacterCountParamsType>): Promise<Observation[]> {
- const { text } = args;
- const count = text ? text.replace(/\s/g, '').length : 0;
- return [{ type: 'text', text: `Character count (excluding spaces): ${count}` }];
- }
- } \ No newline at end of file
diff --git a/src/client/views/nodes/chatbot/tools/dynamic/InspirationalQuotesTool.ts b/src/client/views/nodes/chatbot/tools/dynamic/InspirationalQuotesTool.ts
new file mode 100644
index 000000000..23bbe1d76
--- /dev/null
+++ b/src/client/views/nodes/chatbot/tools/dynamic/InspirationalQuotesTool.ts
@@ -0,0 +1,39 @@
+import { Observation } from '../../types/types';
+import { ParametersType, ToolInfo } from '../../types/tool_types';
+import { BaseTool } from '../BaseTool';
+
+const inspirationalQuotesParams = [
+ {
+ name: 'category',
+ type: 'string',
+ description: 'The category of inspirational quotes to retrieve',
+ required: false
+ }
+ ] as const;
+
+ type InspirationalQuotesParamsType = typeof inspirationalQuotesParams;
+
+ const inspirationalQuotesInfo: ToolInfo<InspirationalQuotesParamsType> = {
+ name: 'inspirationalquotestool',
+ description: 'Provides a random inspirational quote from a predefined list.',
+ citationRules: 'No citation needed.',
+ parameterRules: inspirationalQuotesParams
+ };
+
+ export class InspirationalQuotesTool extends BaseTool<InspirationalQuotesParamsType> {
+ constructor() {
+ super(inspirationalQuotesInfo);
+ }
+
+ async execute(args: ParametersType<InspirationalQuotesParamsType>): Promise<Observation[]> {
+ const quotes = [
+ "The only way to do great work is to love what you do. - Steve Jobs",
+ "The best time to plant a tree was 20 years ago. The second best time is now. - Chinese Proverb",
+ "Your time is limited, so don’t waste it living someone else’s life. - Steve Jobs",
+ "Not everything that is faced can be changed, but nothing can be changed until it is faced. - James Baldwin",
+ "The purpose of our lives is to be happy. - Dalai Lama"
+ ];
+ const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
+ return [{ type: 'text', text: randomQuote }];
+ }
+ } \ No newline at end of file