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
40
41
42
|
import { Observation } from '../../types/types';
import { ParametersType, ToolInfo } from '../../types/tool_types';
import { BaseTool } from '../BaseTool';
const alignDocumentsParams = [
{
name: 'alignmenttype',
type: 'string',
description: 'The type of alignment: "vertical" or "horizontal".',
required: true
},
{
name: 'numberofdocuments',
type: 'number',
description: 'The number of documents to align.',
required: true
}
] as const;
type AlignDocumentsParamsType = typeof alignDocumentsParams;
const alignDocumentsInfo: ToolInfo<AlignDocumentsParamsType> = {
name: 'aligndocumentstool',
description: 'Provides generic alignment guidelines for a specified number of documents to be aligned vertically or horizontally.',
citationRules: 'No citation needed.',
parameterRules: alignDocumentsParams
};
export class AlignDocumentsTool extends BaseTool<AlignDocumentsParamsType> {
constructor() {
super(alignDocumentsInfo);
}
async execute(args: ParametersType<AlignDocumentsParamsType>): Promise<Observation[]> {
const { alignmenttype, numberofdocuments } = args;
// Provide generic alignment guidelines
const guidelines = Array.from({ length: numberofdocuments }, (_, index) => ({
position: alignmenttype === 'vertical' ? `Position ${index} vertically` : `Position ${index} horizontally`
}));
return [{ type: 'text', text: `Alignment guidelines: ${JSON.stringify(guidelines)}` }];
}
}
|