1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 }];
}
}
|