File size: 6,487 Bytes
07c2476 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | # Contributing
Thank you for your interest in contributing to the AI Imaging Agent! This guide will help you get started.
## Getting Started
### 1. Fork and Clone
```bash
# Fork the repository on GitHub
# Then clone your fork
git clone https://github.com/YOUR_USERNAME/ai-agent.git
cd ai-agent
```
### 2. Set Up Development Environment
```bash
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
```
### 3. Create a Branch
```bash
git checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-description
```
## Development Workflow
### Making Changes
1. **Make your changes** in the appropriate module
2. **Test your changes** (see [Testing](testing.md))
3. **Update documentation** if needed
4. **Update CHANGELOG.md** following [Keep a Changelog](https://keepachangelog.com/) format
<!-- ### Code Style
We use standard Python tools for code quality:
#### Black
Code formatting:
```bash
black src/ tests/
```
#### Ruff
Linting:
```bash
ruff check src/ tests/
``` -->
#### Type Checking
MyPy for type checking:
```bash
mypy src/
```
### Running Tests
```bash
# Run all tests
pytest tests/
# Run specific test file
pytest tests/test_retrieval_pipeline.py
# Run with coverage
pytest --cov=ai_agent tests/
```
## Contribution Guidelines
### Code Quality
- **Follow PEP 8**: Use Black for formatting
- **Type hints**: Add type annotations to new functions
- **Docstrings**: Document all public functions and classes
- **Tests**: Add tests for new functionality
- **No warnings**: Fix any linter warnings before submitting
### Commit Messages
Use clear, descriptive commit messages:
```
feat: Add alternative search tool for agent
- Implement search_alternative tool
- Add retry logic for insufficient results
- Update agent prompt with tool description
```
**Format**:
- `feat:` New features
- `fix:` Bug fixes
- `docs:` Documentation changes
- `test:` Test additions/changes
- `refactor:` Code refactoring
- `chore:` Maintenance tasks
### Pull Requests
1. **Update CHANGELOG.md** under `[Unreleased]` section
2. **Write clear PR description** explaining changes
3. **Link related issues** if applicable
4. **Request review** from maintainers
**PR description template**:
```markdown
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
## Testing
How to test these changes
## Checklist
- [ ] Code follows project style
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] CHANGELOG.md updated
```
## Areas to Contribute
### High Priority
- **Catalog expansion**: Add more imaging tools
- **Demo integration**: Improve Gradio Space execution and add new spaces for tools
- **Format support**: Add new image format handlers
<!-- ### Good First Issues
Look for issues tagged `good-first-issue` on GitHub:
- Bug fixes
- Documentation improvements
- Test coverage expansion
- Example scripts -->
### Feature Requests
Before implementing new features:
1. **Check existing issues** for similar requests
2. **Open an issue** to discuss the feature
3. **Get feedback** from maintainers
4. **Implement** after discussion
## Documentation
### Writing Documentation
Documentation lives in `docs/` and uses MkDocs Material.
```bash
# Install MkDocs
pip install mkdocs-material
# Serve locally
mkdocs serve
# Open http://127.0.0.1:8000
```
### Documentation Style
- Use **clear headings** and structure
- Include **code examples** where relevant
- Add **warnings** and **tips** for important information
- Keep **language simple** and accessible
## Adding Tools to Catalog
### Process
1. **Create tool entry** in `dataset/catalog.jsonl`:
```json
{
"@type": "SoftwareSourceCode",
"name": "ToolName",
"description": "Tool description",
"url": "https://github.com/user/tool",
"license": "Apache-2.0",
"keywords": ["segmentation", "CT"],
"supportingData": {
"modalities": ["CT"],
"dimensions": ["3D"],
"formats": ["DICOM"],
"demo_url": "https://huggingface.co/spaces/user/tool"
}
}
```
2. **Validate entry**:
```bash
# Check JSON syntax
python -c "import json; print(json.loads('YOUR_JSON_HERE'))"
```
3. **Update checksum**:
```bash
shasum dataset/catalog.jsonl > dataset/catalog.jsonl.sha1
```
4. **Sync catalog**:
```bash
ai_agent sync
```
5. **Test retrieval**:
```bash
ai_agent chat
# Try queries that should return your new tool
```
### Tool Criteria
Tools should:
- ✅ Be relevant to imaging analysis
- ✅ Be actively maintained
- ✅ Have clear documentation
- ✅ Preferably have a runnable demo
- ✅ Be open-source or have free tier
## Reporting Issues
### Bug Reports
Include:
- **Description** of the bug
- **Steps to reproduce**
- **Expected behavior**
- **Actual behavior**
- **Environment** (OS, Python version, etc.)
- **Logs** if available
### Feature Requests
Include:
- **Use case** for the feature
- **Proposed solution** (if you have one)
- **Alternatives considered**
- **Examples** of similar features
## Code Review Process
1. **Automated checks** run on PR (tests, linting)
2. **Maintainer review** provides feedback
3. **Address feedback** and update PR
4. **Approval** from maintainer(s)
5. **Merge** into main branch
## Release Process
Releases follow semantic versioning:
1. Update version in `pyproject.toml`
2. Update `CHANGELOG.md` with release date
3. Create git tag: `git tag v0.2.0`
4. Push tag: `git push origin v0.2.0`
5. GitHub Actions deploys documentation
## Getting Help
- **GitHub Discussions**: Ask questions
- **GitHub Issues**: Report bugs
## Code of Conduct
Be respectful and professional:
- Use welcoming and inclusive language
- Respect differing viewpoints
- Accept constructive criticism
- Focus on what's best for the community
## License
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.
## Next Steps
- Review [Project Structure](structure.md)
- Learn about [Testing](testing.md)
- Read [Architecture Overview](../architecture/overview.md)
|