diff options
| author | Joanne <zehan_ding@brown.edu> | 2025-06-17 13:02:50 -0400 |
|---|---|---|
| committer | Joanne <zehan_ding@brown.edu> | 2025-06-17 13:02:50 -0400 |
| commit | 2aa2c26b95a539d220e46b20cdfbef6ae39d6c43 (patch) | |
| tree | 344a6f798f692fdd4921ab5a6762e907f5ad7b06 /src/client/views/nodes/chatbot/tools/dynamic | |
| parent | 430db63077868fa54829721d6530a810aa4d4588 (diff) | |
| parent | ccfdf905400cd4b81d8cde0f16bb0e15cd65621b (diff) | |
Merge branch 'agent-paper-main' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/dynamic')
| -rw-r--r-- | src/client/views/nodes/chatbot/tools/dynamic/InspirationalQuotesTool.ts | 39 |
1 files changed, 39 insertions, 0 deletions
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 |
