aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts')
-rw-r--r--src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts b/src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts
new file mode 100644
index 000000000..53a1dd50d
--- /dev/null
+++ b/src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts
@@ -0,0 +1,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)}` }];
+ }
+ } \ No newline at end of file