This project is a Gradio-based application that enables users to upload CSV files, ask questions about their contents, and receive answers generated by a local Large Language Model (LLM). The application also supports data visualization, where users provide specific details for graph generation.
The application processes user queries using an LLM-powered agent. The LLM generates a structured response that includes:
- A Python script (
filter_script
) to compute the answer from the CSV data.
Users now have full control over visualization, specifying:
- The Graph Type (e.g., bar chart, line plot, scatter plot)
- X-axis label and Y-axis label (these are adjustable parameters)
- Automated Visualization Decisions: Explore AI-assisted recommendations for graph types.
- Enhanced Query Processing: Improve AI’s ability to interpret complex queries.
- Multi-File Support: Enable querying across multiple CSVs.
- Advanced Filtering Logic: Introduce more complex data transformations.
- CSV File Handling
- Upload and validate CSV files
- Handle parsing errors gracefully
- Question Answering
- Accepts both textual and numerical queries
- Uses Cohere’s LLM for local execution
- Implements structured query processing using Pydantic AI
- Graph Plotting & Visualization
- Users must specify the graph type
- X-axis and Y-axis labels are adjustable
- Display plots within the Gradio interface
- Backend: Python, Cohere, Pydantic AI, Pandas, Matplotlib
- Frontend: Gradio
- LLM Model: Cohere Command R+ (configurable)
Ensure you have Python installed (>=3.8) and a Cohere API key.
- Sign up for Cohere and get an API key from Cohere’s platform.
- Clone the repository:
git clone <repo-url> cd <repo-folder>
- Install dependencies:
pip install -r requirements.txt
- Run the application:
python main.py
Modify config.yml
to adjust the LLM settings:
Agent:
model_name: "command-r-plus"
api_key: 'COHERE_API_KEY'
- Upload a CSV file through the Gradio interface.
- Enter a question related to the dataset (e.g., "What is the average price?").
- The LLM generates a Python script to compute the answer from the CSV.
- If visualization is required, provide:
- Graph Type (e.g., bar, line, scatter)
- X-axis label and Y-axis label (these can be adjusted as needed)
- View the response and visualization (if applicable) directly in the Gradio UI.
Run tests using:
pytest test/
This project is open-source and available under the MIT License.