feat(ml): fuse two embedding models and protect the ML service with a token

This commit is contained in:
shira committed 2026-10-11 14:40:52 +03:00
1 parent bc00d6901f
commit b24e5ff906
63 files changed
+2287 -276

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# ML service standard
The ML service is a separate Python HTTP service. It serves health and readiness routes and one model-backed endpoint, `POST /v1/embeddings`, with a pinned embedding model baked into its image. Ordinary tests use the deterministic fake encoder; the real model runs only in the marked slow test.
The ML service is a separate Python HTTP service. It serves health and readiness routes and one model-backed endpoint, `POST /v1/embeddings`, with pinned embedding models whose files are verified against the lock files in ml/model/ (baked into the image, or local files on a GPU host). Every route except health and readiness requires the shared bearer token. Ordinary tests use the deterministic fake encoder; the real models run only in the marked slow tests.
Keep the service contract in api/ml/. The Go client uses backend/codegen/ogen-ml.yml and is consumed under backend/internal/adapter/secondary/ml/api/. Python model generation belongs to ml/codegen/pyproject.toml: datamodel-code-generator produces Pydantic v2 models from api/ml/openapi.bundle.yml in ml/src/lincodex_ml/api/models.py. Keep generator dependencies in ml/pyproject.toml and uv.lock; the codegen pyproject contains tool settings only. Health/readiness handlers import generated models instead of maintaining duplicate transport schemas.