Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,277 +1,280 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: DS-STAR
|
| 3 |
-
emoji: ✨
|
| 4 |
-
colorFrom: purple
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 6.0.1
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
short_description: Multi-Agent AI System for Automated Data Science Tasks
|
| 12 |
-
tags:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
[](https://huggingface.co/spaces/Anurag-Deo/DS-STAR)
|
| 30 |
+
[](https://opensource.org/licenses/MIT)
|
| 31 |
+
[](https://www.python.org/downloads/)
|
| 32 |
+
[](https://langchain-ai.github.io/langgraph/)
|
| 33 |
+
|
| 34 |
+
**A powerful multi-agent AI system that automates data science tasks through intelligent collaboration.**
|
| 35 |
+
|
| 36 |
+
[🚀 Try Demo](https://huggingface.co/spaces/Anurag-Deo/DS-STAR) • [📖 Documentation](#-usage) • [🐛 Report Bug](https://github.com/Anurag-Deo/DS-STAR/issues)
|
| 37 |
+
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## 🎯 What is DS-STAR?
|
| 43 |
+
|
| 44 |
+
DS-STAR is a **multi-agent AI system** built with LangGraph that takes your natural language questions about data and automatically:
|
| 45 |
+
|
| 46 |
+
1. 📊 **Analyzes** your data files to understand their structure
|
| 47 |
+
2. 📝 **Plans** a step-by-step approach to answer your question
|
| 48 |
+
3. 💻 **Generates** Python code to perform the analysis
|
| 49 |
+
4. ✅ **Verifies** the solution meets your requirements
|
| 50 |
+
5. 🔄 **Iterates** with smart backtracking if needed
|
| 51 |
+
6. 🎯 **Delivers** polished, accurate results
|
| 52 |
+
|
| 53 |
+
> **Built for the 🤗 Hugging Face MCP 1st Birthday Hackathon**
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## ✨ Key Features
|
| 58 |
+
|
| 59 |
+
| Feature | Description |
|
| 60 |
+
|---------|-------------|
|
| 61 |
+
| 🤖 **Multi-Agent Architecture** | Six specialized agents working in harmony |
|
| 62 |
+
| 🔄 **Iterative Refinement** | Automatically improves solutions through multiple cycles |
|
| 63 |
+
| 🔙 **Smart Backtracking** | Intelligently reverts failed approaches |
|
| 64 |
+
| 📊 **Auto Data Analysis** | Understands your data structure automatically |
|
| 65 |
+
| 💻 **Code Generation** | Produces clean, executable Python code |
|
| 66 |
+
| 🌐 **Multi-Provider Support** | Works with Google, OpenAI, Anthropic, or custom APIs |
|
| 67 |
+
| 🎨 **Modern UI** | Beautiful dark-themed Gradio interface |
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## 🏗️ Architecture
|
| 72 |
+
|
| 73 |
+
DS-STAR uses a sophisticated multi-agent workflow powered by LangGraph:
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
| 77 |
+
│ Analyzer │────▶│ Planner │────▶│ Coder │
|
| 78 |
+
│ 📊 Analyze │ │ 📝 Plan │ │ 💻 Code │
|
| 79 |
+
└─────────────┘ └─────────────┘ └─────────────┘
|
| 80 |
+
│
|
| 81 |
+
▼
|
| 82 |
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
| 83 |
+
│ Finalyzer │◀────│ Router │◀────│ Verifier │
|
| 84 |
+
│ 🎯 Polish │ │ 🔀 Route │ │ ✅ Verify │
|
| 85 |
+
└─────────────┘ └─────────────┘ └─────────────┘
|
| 86 |
+
│
|
| 87 |
+
▼
|
| 88 |
+
┌─────────────┐
|
| 89 |
+
│ Backtrack │
|
| 90 |
+
│ ↩️ Retry │
|
| 91 |
+
└─────────────┘
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
### Agent Roles
|
| 95 |
+
|
| 96 |
+
| Agent | Role | Description |
|
| 97 |
+
|-------|------|-------------|
|
| 98 |
+
| **Analyzer** | 📊 | Examines all data files and creates detailed descriptions |
|
| 99 |
+
| **Planner** | 📝 | Generates the next logical step in the solution |
|
| 100 |
+
| **Coder** | 💻 | Implements the plan as executable Python code |
|
| 101 |
+
| **Verifier** | ✅ | Validates if the solution answers the query |
|
| 102 |
+
| **Router** | 🔀 | Decides to continue, add steps, or backtrack |
|
| 103 |
+
| **Finalyzer** | 🎯 | Polishes and formats the final output |
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## 🚀 Quick Start
|
| 108 |
+
|
| 109 |
+
### Online Demo
|
| 110 |
+
|
| 111 |
+
Try DS-STAR instantly on Hugging Face Spaces:
|
| 112 |
+
|
| 113 |
+
👉 **[Launch DS-STAR Demo](https://huggingface.co/spaces/Anurag-Deo/DS-STAR)**
|
| 114 |
+
|
| 115 |
+
### Local Installation
|
| 116 |
+
|
| 117 |
+
```bash
|
| 118 |
+
# Clone the repository
|
| 119 |
+
git clone https://github.com/Anurag-Deo/DS-STAR.git
|
| 120 |
+
cd DS-STAR
|
| 121 |
+
|
| 122 |
+
# Create virtual environment
|
| 123 |
+
python -m venv .venv
|
| 124 |
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
| 125 |
+
|
| 126 |
+
# Install dependencies
|
| 127 |
+
pip install -r requirements.txt
|
| 128 |
+
|
| 129 |
+
# Run the application
|
| 130 |
+
python app.py
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
Then open http://localhost:7860 in your browser.
|
| 134 |
+
|
| 135 |
+
---
|
| 136 |
+
|
| 137 |
+
## 💡 Usage
|
| 138 |
+
|
| 139 |
+
### Web Interface
|
| 140 |
+
|
| 141 |
+
1. **Select Provider** — Choose Google, OpenAI, Anthropic, or Custom
|
| 142 |
+
2. **Enter API Key** — Or set via environment variable
|
| 143 |
+
3. **Upload Data** — Drop your CSV, JSON, Excel, or Parquet files
|
| 144 |
+
4. **Ask Questions** — Type your data science question
|
| 145 |
+
5. **Run Analysis** — Click "Run Analysis" and watch the magic!
|
| 146 |
+
|
| 147 |
+
### Example Queries
|
| 148 |
+
|
| 149 |
+
```
|
| 150 |
+
📊 "What percentage of transactions use credit cards?"
|
| 151 |
+
📈 "Show me the distribution of transaction amounts"
|
| 152 |
+
🏆 "Which category has the highest total sales?"
|
| 153 |
+
🔗 "Find correlations between numeric columns"
|
| 154 |
+
📋 "Create a summary statistics report"
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
### Python API
|
| 158 |
+
|
| 159 |
+
```python
|
| 160 |
+
from src.graph import run_ds_star
|
| 161 |
+
from src.config import get_llm
|
| 162 |
+
|
| 163 |
+
# Initialize LLM
|
| 164 |
+
llm = get_llm(provider="google", model="gemini-2.0-flash")
|
| 165 |
+
|
| 166 |
+
# Run DS-STAR
|
| 167 |
+
result = run_ds_star(
|
| 168 |
+
query="What is the average transaction amount?",
|
| 169 |
+
llm=llm,
|
| 170 |
+
max_iterations=20
|
| 171 |
+
)
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## 🔌 Supported Providers
|
| 177 |
+
|
| 178 |
+
| Provider | Models | Environment Variable |
|
| 179 |
+
|----------|--------|---------------------|
|
| 180 |
+
| **Google** | Gemini 2.0, 1.5 Pro, 1.5 Flash | `GOOGLE_API_KEY` |
|
| 181 |
+
| **OpenAI** | GPT-4o, GPT-4, GPT-3.5 | `OPENAI_API_KEY` |
|
| 182 |
+
| **Anthropic** | Claude 3.5, Claude 3 | `ANTHROPIC_API_KEY` |
|
| 183 |
+
| **Custom** | Any OpenAI-compatible API | Custom Base URL |
|
| 184 |
+
|
| 185 |
+
---
|
| 186 |
+
|
| 187 |
+
## 📁 Project Structure
|
| 188 |
+
|
| 189 |
+
```
|
| 190 |
+
DS-STAR/
|
| 191 |
+
├── 📱 app.py # Gradio web application
|
| 192 |
+
├── 📜 main.py # CLI entry point
|
| 193 |
+
├── 📋 requirements.txt # Dependencies
|
| 194 |
+
├── 📂 src/
|
| 195 |
+
│ ├── 🤖 agents/ # Agent implementations
|
| 196 |
+
│ │ ├── analyzer_agent.py
|
| 197 |
+
│ │ ├── planner_agent.py
|
| 198 |
+
│ │ ├── coder_agent.py
|
| 199 |
+
│ │ ├── verifier_agent.py
|
| 200 |
+
│ │ ├── router_agent.py
|
| 201 |
+
│ │ └── finalyzer_agent.py
|
| 202 |
+
│ ├── 🔧 utils/ # Shared utilities
|
| 203 |
+
│ │ ├── state.py # State schema
|
| 204 |
+
│ │ ├── formatters.py # Text formatting
|
| 205 |
+
│ │ └── code_execution.py # Safe code execution
|
| 206 |
+
│ ├── ⚙️ config/ # Configuration
|
| 207 |
+
│ │ └── llm_config.py # LLM setup
|
| 208 |
+
│ └── 🔄 graph.py # LangGraph workflow
|
| 209 |
+
├── 🧪 tests/ # Test suite
|
| 210 |
+
└── 📊 data/ # Sample data files
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
---
|
| 214 |
+
|
| 215 |
+
## 🧪 Testing
|
| 216 |
+
|
| 217 |
+
```bash
|
| 218 |
+
# Run complete workflow test
|
| 219 |
+
python tests/test_complete_workflow.py
|
| 220 |
+
|
| 221 |
+
# Test individual agents
|
| 222 |
+
python -c "from src.agents import test_analyzer; test_analyzer(llm)"
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
---
|
| 226 |
+
|
| 227 |
+
## 🛠️ Configuration
|
| 228 |
+
|
| 229 |
+
### Environment Variables
|
| 230 |
+
|
| 231 |
+
```bash
|
| 232 |
+
# Set your API keys
|
| 233 |
+
export GOOGLE_API_KEY="your-google-api-key"
|
| 234 |
+
export OPENAI_API_KEY="your-openai-api-key"
|
| 235 |
+
export ANTHROPIC_API_KEY="your-anthropic-api-key"
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
### Advanced Settings
|
| 239 |
+
|
| 240 |
+
| Setting | Default | Description |
|
| 241 |
+
|---------|---------|-------------|
|
| 242 |
+
| Max Iterations | 20 | Maximum refinement cycles |
|
| 243 |
+
| Temperature | 0.0 | LLM temperature (0 = deterministic) |
|
| 244 |
+
|
| 245 |
+
---
|
| 246 |
+
|
| 247 |
+
## 🤝 Contributing
|
| 248 |
+
|
| 249 |
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
| 250 |
+
|
| 251 |
+
1. Fork the repository
|
| 252 |
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
| 253 |
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
| 254 |
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
| 255 |
+
5. Open a Pull Request
|
| 256 |
+
|
| 257 |
+
---
|
| 258 |
+
|
| 259 |
+
## 📄 License
|
| 260 |
+
|
| 261 |
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
| 262 |
+
|
| 263 |
+
---
|
| 264 |
+
|
| 265 |
+
## 🙏 Acknowledgments
|
| 266 |
+
|
| 267 |
+
- Thanks to [DS-STAR](https://arxiv.org/abs/2509.21825) authors for inspiration
|
| 268 |
+
- Built with [LangGraph](https://langchain-ai.github.io/langgraph/) by LangChain
|
| 269 |
+
- UI powered by [Gradio](https://gradio.app/)
|
| 270 |
+
- Created for the [🤗 Hugging Face MCP 1st Birthday Hackathon](https://huggingface.co/)
|
| 271 |
+
|
| 272 |
+
---
|
| 273 |
+
|
| 274 |
+
<div align="center">
|
| 275 |
+
|
| 276 |
+
**Made with ❤️ by [Anurag Deo](https://github.com/Anurag-Deo)**
|
| 277 |
+
|
| 278 |
+
⭐ Star this repo if you find it helpful!
|
| 279 |
+
|
| 280 |
+
</div>
|