aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-08-15 08:47:46 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-08-15 08:47:46 -0400
commit0c8001c61a55540cdeeb6ae249fdd2835580121c (patch)
tree924aae0ad45fd85c98986f5161ce6ccf2482847d /src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts
parentcd4b13bacd6639d2a731a05dfca700b201b2073c (diff)
currently works
Diffstat (limited to 'src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts')
-rw-r--r--src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts b/src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts
new file mode 100644
index 000000000..d2edc4847
--- /dev/null
+++ b/src/client/views/nodes/ChatBox/tools/DataAnalysisTool.ts
@@ -0,0 +1,30 @@
+import { BaseTool } from './BaseTool';
+
+export class DataAnalysisTool extends BaseTool<{ csv_file_name: string }> {
+ private csv_files_function: () => { [filename: string]: string };
+ constructor(csv_files: () => { [filename: string]: string }) {
+ super(
+ 'dataAnalysis',
+ 'Analyzes, and provides insights, from a CSV file',
+ {
+ csv_file_name: {
+ type: 'string',
+ description: 'Name of the CSV file to analyze',
+ required: 'true',
+ },
+ },
+ 'Provide the name of the CSV file to analyze based on the user query and whichever available CSV file may be relevant.',
+ 'Provides the full CSV file text for your analysis based on the user query and the available CSV file. '
+ );
+ this.csv_files_function = csv_files;
+ }
+
+ getFileContent(filename: string): string | undefined {
+ const files = this.csv_files_function();
+ return files[filename];
+ }
+
+ async execute(args: { csv_file_name: string }): Promise<any> {
+ return [{ type: 'text', text: this.getFileContent(args.csv_file_name) }];
+ }
+}