# langextract-api (`services/langextract-api/`) API HTTP locale sur **`127.0.0.1`** autour de [google/langextract](https://github.com/google/langextract) : extractions structurées depuis du texte, avec ancrage caractères optionnel. ## Variables | Variable | Obligatoire | Description | |----------|-------------|-------------| | `LANGEXTRACT_SERVICE_TOKEN` | non | Si défini, `Authorization: Bearer` requis. | | `LANGEXTRACT_API_HOST` | non | Défaut `127.0.0.1` | | `LANGEXTRACT_API_PORT` | non | Défaut `37141` | | `LANGEXTRACT_API_KEY` | non | Modèles cloud (ex. Gemini) côté serveur. | ## Endpoints - `GET /health` - `POST /extract` — corps JSON aligné sur les paramètres `extract()` amont (`text`, `prompt_description`, `examples`, `model_id`, `model_url` pour Ollama, etc.) ## Run ```bash cd services/langextract-api python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt export LANGEXTRACT_SERVICE_TOKEN='…' uvicorn app.main:app --host "${LANGEXTRACT_API_HOST:-127.0.0.1}" --port "${LANGEXTRACT_API_PORT:-37141}" ``` Pour Ollama : `model_id` (ex. `gemma2:2b`), `model_url` `http://127.0.0.1:11434`, souvent `fence_output: false`, `use_schema_constraints: false` selon amont. ## Spécification [API/langextract-api.md](../API/langextract-api.md), [features/langextract-api.md](../features/langextract-api.md).