aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/chatbot/tools/FileNamesTool.ts
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-06-17 13:02:50 -0400
committerJoanne <zehan_ding@brown.edu>2025-06-17 13:02:50 -0400
commit2aa2c26b95a539d220e46b20cdfbef6ae39d6c43 (patch)
tree344a6f798f692fdd4921ab5a6762e907f5ad7b06 /src/client/views/nodes/chatbot/tools/FileNamesTool.ts
parent430db63077868fa54829721d6530a810aa4d4588 (diff)
parentccfdf905400cd4b81d8cde0f16bb0e15cd65621b (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/FileNamesTool.ts')
-rw-r--r--src/client/views/nodes/chatbot/tools/FileNamesTool.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/client/views/nodes/chatbot/tools/FileNamesTool.ts b/src/client/views/nodes/chatbot/tools/FileNamesTool.ts
new file mode 100644
index 000000000..b69874afa
--- /dev/null
+++ b/src/client/views/nodes/chatbot/tools/FileNamesTool.ts
@@ -0,0 +1,34 @@
+import { Observation } from '../types/types';
+import { ParametersType, ToolInfo } from '../types/tool_types';
+import { Vectorstore } from '../vectorstore/Vectorstore';
+import { BaseTool } from './BaseTool';
+
+const fileNamesToolParams = [] as const;
+
+type FileNamesToolParamsType = typeof fileNamesToolParams;
+
+const fileNamesToolInfo: ToolInfo<FileNamesToolParamsType> = {
+ name: 'fileNames',
+ description: 'Retrieves the names of all files in the Dash codebase to help understand the codebase structure.',
+ citationRules: `No citation needed.`,
+ parameterRules: fileNamesToolParams,
+};
+
+export class FileNamesTool extends BaseTool<FileNamesToolParamsType> {
+ constructor(private vectorstore: Vectorstore) {
+ super(fileNamesToolInfo);
+ }
+
+ async execute(args: ParametersType<FileNamesToolParamsType>): Promise<Observation[]> {
+ console.log(`Executing file names retrieval`);
+
+ const filepaths = await this.vectorstore.getFileNames();
+
+ return [
+ {
+ type: 'text',
+ text: `The file names in the codebase are: ${filepaths}`,
+ },
+ ];
+ }
+}