
Node Details
- Name:
csvAgent
- Type:
AgentExecutor
- Category: [[Agents]]
- Version: 3.0
Description
This agent is used to answer queries on CSV data. It leverages a language model to interpret user questions, generates Python code to analyze the CSV data, and then provides human-readable answers based on the analysis results.Parameters
-
CSV File (Required)
- Type: file
- File Type: .csv
- Description: The CSV file to be analyzed.
-
Language Model (Required)
- Type: BaseLanguageModel
- Description: The language model used for interpreting queries and generating responses.
-
System Message (Optional)
- Type: string
- Description: A custom system message to set the behavior of the agent.
- Default: A predefined message instructing the agent to act as an AI assistant.
-
Input Moderation (Optional)
- Type: Moderation[]
- Description: Applies moderation to detect potentially harmful input before processing.
-
Custom Pandas Read_CSV Code (Optional)
- Type: code
- Description: Custom Pandas read_csv function to load the CSV data.
- Default:
read_csv(csv_data)
Input
- A natural language query about the data in the specified CSV file.
Output
- A detailed answer to the query, based on analysis of the CSV data.
How It Works
- The agent first loads the CSV file using either the default or custom Pandas read_csv function.
- It converts the CSV data into a Pandas DataFrame using Pyodide (a Python runtime for the browser).
- A language model interprets the user’s query and generates Python code to analyze the data.
- The generated Python code is executed using Pyodide to perform the analysis.
- The results of the analysis are then passed back to the language model to generate a human-readable response.
- The final answer is returned to the user.
Use Cases
- Querying CSV data without writing complex formulas or scripts.
- Generating insights and summaries from CSV files.
- Performing data analysis on CSV content using natural language queries.
- Educational tools for teaching data analysis concepts.
- Quick data exploration for business intelligence.
Special Features
- File Storage Integration: Can load CSV files from file storage systems.
- Custom CSV Loading: Supports custom Pandas read_csv code for specialized CSV loading requirements.
- Input Moderation: Optional moderation to prevent processing of potentially harmful queries.
- Streaming Responses: Supports both streaming and non-streaming response modes.
Notes
- The node uses Pyodide to run Python code in a JavaScript environment, allowing for powerful data analysis capabilities.
- It supports loading multiple CSV files if needed.
- The system message can be customized to tailor the agent’s behavior and response style.
- Error handling is implemented to provide meaningful feedback if the analysis fails.