docs: simplify project guides and add GPLv3

This commit is contained in:
TakuyaYagam1 committed 2026-10-11 22:25:10 +03:00
1 parent e4de6d0f9a
commit 76d32bb79f
59 files changed
+2267 -8843

No files matched your search

+18 -9
View File
@@ -2,15 +2,24 @@
[Русский](README.md) | English
A separate Python service using FastAPI. It serves `POST /v1/embeddings` with the pinned Giga-Embeddings-instruct-480M and Qwen3-Embedding-0.6B models for semantic matching (the `ML_EMBEDDER` list; the optional `model` field selects the model, and a request for a model the service has not loaded gets 400), plus `/healthz`, `/readyz`, and metrics. It runs on CPU or CUDA (`ML_DEVICE`, `ML_DTYPE`, `ML_CUDA_MEMORY_LIMIT_MB`); a lack of device memory gives 503, not a crash. Every route except `/healthz` and `/readyz` requires a bearer token (`ML_SERVICE_TOKEN` or `ML_SERVICE_TOKEN_FILE`); without a token the service answers loopback callers only, and `python -m lincodex_ml.serve` does not listen on a non-loopback address. `/readyz` returns 503 until the models are loaded and warmed up, and always without a model (`ML_EMBEDDER=none`, the default outside the image). The model files are pinned by the lock files `model/*.lock.json` and verified by SHA-256; see [deployment](../docs/en/DEPLOY.md#separate-ml-compose-project) and [the GPU host](../docs/en/DEPLOY.md#ml-service-on-a-gpu-host).
Python/FastAPI embedding service for semantic matching. `POST /v1/embeddings` uses Giga-Embeddings-instruct-480M or Qwen3-Embedding-0.6B; model revisions and file SHA-256 hashes are pinned in `model/`. Text generation and resume analysis are outside the current HTTP service.
- `src/lincodex_ml/` contains the application, HTTP routes, and infrastructure code.
- `codegen/` configures Pydantic model generation from `api/ml/`.
- `tests/` checks service health, the embedding contract with a fake encoder, several models, the token, a lack of device memory, the model locks, and (marked `slow`, `make -C ml test-model`) the real models against the study vectors.
- `model/` pins the model revisions and the SHA-256 of their files.
- `scripts/` checks Pydantic models generated from the OpenAPI 3.2 fixture.
- `pyproject.toml` and `uv.lock` define dependencies and Python tool settings.
- `src/lincodex_ml/` - API, model loading, and CPU/CUDA inference.
- `codegen/` - Pydantic models generated from `api/ml/`.
- `tests/` - unit, contract, and separate real-model tests.
- `model/` - weight revisions and hashes; `uv.lock` - Python dependencies.
From the repository root, `make -C ml check` runs checks, `make -C ml run` starts the service locally on 127.0.0.1:8000, and `make -C ml cuda-requirements` writes the dependency list of a GPU host. To use its separate Compose project, run `make -C deploy ml-up` after preparing `.env`.
From the repository root:
See [development](../docs/en/DEVELOPMENT.md) and [deployment](../docs/en/DEPLOY.md).
```sh
make -C ml install
make -C ml check
make -C deploy ml-build
make -C deploy ml-up
```
Compose needs a running core and the shared `ML_SERVICE_TOKEN` in `.env`. The image includes both models; `/readyz` returns 200 after loading and warmup. The configured bearer token protects every route except `/healthz` and `/readyz`. Without a token, access is limited to loopback clients.
For a local process, run `make -C ml model-fetch`, then `make -C ml run` with `ML_EMBEDDER` and model directories in the environment. `make -C ml test-model` checks real weights; `cuda-requirements` prepares GPU dependencies. Ordinary tests do not establish matching quality or model performance.
Semantic policy setup, CPU Compose, and a GPU host: [DEPLOYMENT.md](../docs/en/DEPLOYMENT.md#separate-ml-compose-project).