AyoubChLin's picture
feat: initial commit of Classifier General API with FastAPI
50231a8
# API Reference
Base URL: `http://localhost:4002`
Evidence:
- `app/api/router.py`
- `app/routers/classification.py`
- `app/routers/health.py`
## Endpoints
| Method | Path | Request | Response |
|---|---|---|---|
| GET | `/health/liveness` | none | `{status}` |
| GET | `/health/readiness` | none | `{status, labels_count}` |
| GET | `/endpoint/` | none | list of routes/methods |
| POST | `/api/classifier` | `{text}` | `"<label>"` |
| POST | `/api/language` | `{text}` | `"<language>"` |
| POST | `/api/transformer` | multipart `file` | `{filename, content}` |
| POST | `/classify` | multipart `file` | `{label, language, type?}` |
| POST | `/configlabel` | `{text: "csv,labels"}` | `string[]` |
| GET | `/labels` | none | `string[]` |
## Validation and errors
- `400` for input validation and extraction problems.
- `502` for upstream classifier/language failures.
- `500` for unexpected failures.
Evidence:
- `app/routers/classification.py` (`_handle_exception`)
- `app/schemas/classification.py`
## Contract notes
- Contract returns plain string for `/api/classifier` and `/api/language` (not wrapped object).
- `/classify` returns optional `type="not english"` when language output is not `en`.
Evidence:
- `app/routers/classification.py`
- `app/pipelines/classification_pipeline.py`