diff options
| author | bobzel <zzzman@gmail.com> | 2025-07-08 20:42:30 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2025-07-08 20:42:30 -0400 |
| commit | 0a6d0bb9b9630985ffd8a4b923e31f001bb03f7c (patch) | |
| tree | d3303698aae0ce68b0ba1a05a8c5bdc6a53ef5e8 /src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts | |
| parent | 87a9c8082c122ad6bc7e8c4f9d6a50bc09ae38ee (diff) | |
| parent | 95c0d9b0ed3cf8bf50f3a3eac2f1dff146ba131c (diff) | |
Merge branch 'agent-paper-main' into lanyi-expanded-agent-paper-main
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts')
| -rw-r--r-- | src/client/views/nodes/chatbot/tools/dynamic/AlignDocumentsTool.ts | 42 |
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 |
