LOT 1 - Optimizare script build -Instalare mono comanda

This commit is contained in:
Dezvoltari Evotech 2026-06-27 06:42:02 -07:00
parent 5380c3fc63
commit 42ff22bf85
127 changed files with 16163 additions and 532 deletions

View file

@ -114,6 +114,98 @@ Each extractor returns a uniform `FeatureResult`:
| `confidence` | number\|null | 0..1 (extraction confidence, not a verdict) |
| `error` | string\|null | Set when `ok` is false |
### POST /v1/sentiment
Classify the sentiment of a text via the LLM gateway (Romanian-aware prompt,
detects irony/sarcasm). **Delegated to the LLM gateway** — returns `503` if no
gateway is configured.
**Request** — `application/json`
| Field | Type | Description |
|-------|------|-------------|
| `text` | string | Text to analyze (min length 1) |
```bash
curl -X POST http://localhost:54400/v1/sentiment \
-H "Content-Type: application/json" \
-d '{"text": "Ce zi frumoasă!"}'
```
**Response** `200 OK` — a `FeatureResult` (same schema as above), e.g.:
```json
{
"tool_id": "sentiment",
"name": "Sentiment",
"ok": true,
"results": { "label": "positive", "score": 0.92 },
"evidence": ["Sentiment: positive (0.92)."],
"anomalies": [],
"confidence": 0.92
}
```
### POST /v1/ner
Extract named entities via GLiNER multilingual (`urchade/gliner_multi-v2.1`).
**Requires the optional `ml` extra** — returns `503` if the model is unavailable.
**Request** — `application/json`
| Field | Type | Description |
|-------|------|-------------|
| `text` | string | Text to analyze (min length 1) |
| `labels` | string[] \| null | Entity types to extract (defaults to the RO set) |
```bash
curl -X POST http://localhost:54400/v1/ner \
-H "Content-Type: application/json" \
-d '{"text": "Klaus Iohannis și Guvernul României."}'
```
**Response** `200 OK` — a `FeatureResult`; `results` carries the extracted
entities (text, label, span, score).
### POST /v1/ocr
Extract visible text verbatim from an image via the LLM vision model.
**Delegated to the LLM gateway** — returns `503` if no gateway is configured.
**Request** — `multipart/form-data`
| Field | Type | Description |
|-------|------|-------------|
| `file` | file | Image file |
```bash
curl -X POST http://localhost:54400/v1/ocr \
-F "file=@scan.png"
```
**Response** `200 OK` — a `FeatureResult`; `results` carries the recognized text.
### POST /v1/detect
Detect objects (COCO classes) via YOLO (`yolov8n`), returning boxes + confidence.
**Requires the optional `ml` extra** — returns `503` if the model is unavailable.
**Request** — `multipart/form-data`
| Field | Type | Description |
|-------|------|-------------|
| `file` | file | Image file |
Optional query param: `threshold` (float, 0..1) — confidence threshold.
```bash
curl -X POST "http://localhost:54400/v1/detect?threshold=0.4" \
-F "file=@street.jpg"
```
**Response** `200 OK` — a `FeatureResult`; `results` carries detected objects
(label, box, confidence).
## Error Responses
| Status | Meaning |
@ -121,6 +213,8 @@ Each extractor returns a uniform `FeatureResult`:
| 400 | Empty file |
| 413 | File exceeds `EXTRACTORS_MAX_UPLOAD_MB` |
| 422 | Missing `file` field |
| 502 | `LLMError` — the LLM gateway returned an error (`/v1/sentiment`, `/v1/ocr`) |
| 503 | `LLMNotConfigured` (no gateway for `/v1/sentiment`, `/v1/ocr`) or the `ml` extra/model is unavailable (`/v1/ner`, `/v1/detect`) |
```json
{ "detail": "empty file" }