# AI-QA SDK Quick Start

## 5-minute setup for in-house use

### Installation

```bash
pip install -e ".[dev]"
```

### 1. Validate a single output

```bash
ai-qa validate \
  --output "Paris is the capital of France" \
  --checks factuality,relevance
```

### 2. List available checks

```bash
ai-qa checks
```

### 3. Run a batch test

Create `tests.json`:
```json
[
  {"test_id": "T001", "output": "Paris is in France", "checks": ["factuality"]},
  {"test_id": "T002", "output": "2+2=5", "checks": ["factuality"]},
  {"test_id": "T003", "output": "I like pizza", "input": "How to install Python?", "checks": ["relevance"]}
]
```

Run it:
```bash
ai-qa suite tests.json --format html --output report.html
```

---

## Key Features

✅ **No coding required** — Use CLI directly
✅ **18 built-in checks** — Factuality, relevance, toxicity, hallucination, more
✅ **Batch validation** — Run 1000 tests at once
✅ **Beautiful reports** — JSON, HTML, table formats
✅ **Fast & cached** — Intelligent caching avoids re-computation
✅ **Team-friendly** — QA engineers, data teams can use immediately

---

## Use Cases

**QA Testing:**
```bash
ai-qa validate --output "$chatbot_response" --input "$user_query" \
  --checks relevance,coherence,toxicity
```

**RAG Validation:**
```bash
ai-qa validate --output "$answer" --context "$retrieved_chunk" \
  --checks groundedness,hallucination
```

**Batch Monitoring:**
```bash
ai-qa suite production_outputs.json --format json --output metrics.json
```

**CI/CD Integration:**
```bash
ai-qa suite tests.json || exit 1  # Fail if any check fails
```

---

## Check Types

| Category | Checks |
|----------|--------|
| **Accuracy** | factuality, relevance, consistency |
| **Safety** | toxicity, bias, injection_detection |
| **Hallucination** | hallucination, groundedness |
| **Structure** | schema, json_format, regex |
| **Style** | coherence, tone, conciseness |

See `ai-qa checks` for full list and details.

---

## Documentation

- **CLI Guide:** [CLI_USAGE.md](./CLI_USAGE.md) — Complete command reference
- **Examples:** `examples/` — Real-world scripts
- **API Reference:** [API.md](./API.md) — Python usage

---

## Support

- **Issues:** GitHub Issues
- **Questions:** GitHub Discussions
- **Bugs:** Report with `ai-qa validate --output "..." > bug-report.json`

---

## What's Next?

1. ✅ Validate your first output: `ai-qa validate --output "..." --checks factuality`
2. 📊 Create a test suite: `ai-qa suite tests.json --format html`
3. 🔧 Integrate with CI/CD: Add to GitHub Actions/Jenkins
4. 📈 Monitor quality: Run daily and track metrics

**Ready to go!** 🚀
