smart_ide/docs/repo/service-langextract.md
Nicolas Cantu 466ed6b65f chore(gitmodules): document service paths, add langextract upstream submodule
- Comment block mapping services to submodule paths (carbonyl/chandra/pageindex/langextract upstream)
- Note agent-regex-search-api and claw-harness-api as in-repo only
- Add services/langextract-api/upstream → google/langextract (shallow)
- Document submodule and optional pip install -e in service-langextract.md
2026-04-03 22:45:43 +02:00

37 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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.
Le dépôt amont est aussi référencé comme **sous-module Git** : `services/langextract-api/upstream` (voir `.gitmodules` à la racine du monorepo). Après `git clone`, exécuter `git submodule update --init --recursive services/langextract-api/upstream` si le dossier est vide. Par défaut lAPI installe la librairie via **PyPI** (`requirements.txt`). Pour utiliser la révision du sous-module : `pip install -e ./upstream` dans le venv et retirer la ligne `langextract` du fichier `requirements.txt` pour cette installation.
## 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).