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 = { 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 { constructor(private vectorstore: Vectorstore) { super(fileNamesToolInfo); } async execute(args: ParametersType): Promise { console.log(`Executing file names retrieval`); const filepaths = await this.vectorstore.getFileNames(); return [ { type: 'text', text: `The file names in the codebase are: ${filepaths}`, }, ]; } }