Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

fix(compose): forward batch tokens and strict Jev knobs to laya-serve

naveenprasaath23b0aed9726857
diff --git a/compose.http.yaml b/compose.http.yaml
index 7d85a4f1..580cb5bf 100644
--- a/compose.http.yaml
+++ b/compose.http.yaml
@@ -62,6 +62,13 @@ services:
# as 422. The SDK integrations quote 8192 because that is this service's default, so the
# default here stays empty: an operator who sets nothing gets the number the docs print.
LAYA_MAX_TOKEN_BUDGET: "${LAYA_MAX_TOKEN_BUDGET:-}"
+ # Tokens one `/v1/systemone/batch` forward pass may collate (states x questions x row width);
+ # a larger batch is split into several passes, not refused. Empty keeps the server default (131072).
+ LAYA_MAX_BATCH_TOKENS: "${LAYA_MAX_BATCH_TOKENS:-}"
+ # When set to 1, serve the strict Jev wire contract: no root `routing`, no per-answer
+ # `action` / `answer_confidence`, no `confidence` on noul answers, and `usage` reduced to
+ # `input_tokens` + `output_tokens`. Empty keeps the server default (0, full payload).
+ LAYA_JEV_STRICT: "${LAYA_JEV_STRICT:-}"
LAYA_LOG_LEVEL: "${LAYA_LOG_LEVEL:-info}"
# The supply-chain pair: LAYA_REVISION says which Hub commit a checkpoint may load from (a
# commit, branch, tag, or `reviewed` for the SHAs in laya/revisions.py) and
diff --git a/docs/docker.md b/docs/docker.md
index dcabf649..d4d4c115 100644
--- a/docs/docker.md
+++ b/docs/docker.md
@@ -345,6 +345,8 @@ These apply to the `laya-serve` service only.
| `LAYA_API_KEY` | (none) | when set, requires `Authorization: Bearer <key>` |
| `LAYA_ROOT_PATH` | (empty) | public URL prefix for FastAPI when behind a reverse proxy; the proxy should strip it before forwarding |
| `LAYA_MAX_TOKEN_BUDGET` | `8192` | cap on per-request `max_len` and `head_max_len` overrides |
+| `LAYA_MAX_BATCH_TOKENS` | `131072` | tokens one `/v1/systemone/batch` forward pass may collate (`states` × questions × row width); a larger batch is split into several passes, not refused |
+| `LAYA_JEV_STRICT` | `0` | `1` serves the strict Jev wire contract (no root `routing`, no per-answer `action` / `answer_confidence`, reduced `usage`) for strict Jev clients |
| `LAYA_SHA256_DIGESTS` | (none) | JSON digests checked before a checkpoint is parsed: `{artifact: digest}` for every checkpoint, or `{model: {artifact: digest}}` per checkpoint. See [Security](security.md) |
For example, set `LAYA_ROOT_PATH=/laya` when publishing the API under `/laya`. The proxy must
diff --git a/laya/serve.py b/laya/serve.py
index 8706b9fd..c68c4ca9 100644
--- a/laya/serve.py
+++ b/laya/serve.py
@@ -41,6 +41,7 @@ env var meaning defaul
a ``["repo", "subfolder"]`` pair. Served under
explicit ``model=`` like a built-in.
``LAYA_MAX_TOKEN_BUDGET`` cap on per-request max_len / head_max_len 8192
+``LAYA_MAX_BATCH_TOKENS`` cap on batch forward tokens (states x q x len) 131072
``LAYA_JEV_STRICT`` if set, serve the strict Jev wire contract: no 0
root `routing`, no per-answer `action` /
`answer_confidence`, no `confidence` on noul
diff --git a/tests/test_compose_env.py b/tests/test_compose_env.py
index a3152016..4e8dcee7 100644
--- a/tests/test_compose_env.py
+++ b/tests/test_compose_env.py
@@ -537,7 +537,8 @@ if server_doc:
_env = env_blocks(read("compose.http.yaml")).get(_service, {})
check_true("compose/compose.http.yaml defines the %s service" % _service,
_service in env_blocks(read("compose.http.yaml")), sorted(_env))
- for _name in ("LAYA_MAX_CONCURRENT", "LAYA_MAX_TOKEN_BUDGET", "LAYA_REVISION"):
+ for _name in ("LAYA_MAX_CONCURRENT", "LAYA_MAX_TOKEN_BUDGET", "LAYA_REVISION",
+ "LAYA_MAX_BATCH_TOKENS", "LAYA_JEV_STRICT"):
check_true("compose/compose.http.yaml/%s forwards the %s this change adds"
% (_service, _name), _name in _env,
"it is documented and read by the runtime, and the service that needs it "
@@ -579,9 +580,9 @@ if server_doc:
_const_pinned += 1
check("docs/docker.md prints the same %s default as laya/serve.py" % _name,
_cell.strip("`"), _defaults[_const])
- check_true("core/both knobs this change forwards have a module default to pin",
- _const_pinned == 2, _const_pinned)
- for _name in ("LAYA_MAX_CONCURRENT", "LAYA_MAX_TOKEN_BUDGET"):
+ check_true("core/knobs this change forwards have a module default to pin",
+ _const_pinned == 3, _const_pinned)
+ for _name in ("LAYA_MAX_CONCURRENT", "LAYA_MAX_TOKEN_BUDGET", "LAYA_MAX_BATCH_TOKENS"):
check_true("docs/docker.md keeps the %s row in the server table" % _name,
re.search(r"^\| `%s` \|" % _name, _body, re.M) is not None,
"the two sections above derive their demand from this table, so a row "
@@ -610,8 +611,10 @@ if shutil.which("docker"):
# container is the failure the textual checks above are reasoning about. Both arms: set, and
# left alone. The unset arm is the one an operator actually boots, and it must show the empty
# default arriving as empty rather than as the literal `${LAYA_MAX_CONCURRENT:-}`.
- _KN = ("LAYA_MAX_CONCURRENT", "LAYA_MAX_TOKEN_BUDGET", "LAYA_REVISION")
- _arms = [(dict(zip(_KN, ("4", "16384", "reviewed"))), dict(zip(_KN, ("4", "16384", "reviewed")))),
+ _KN = ("LAYA_MAX_CONCURRENT", "LAYA_MAX_TOKEN_BUDGET", "LAYA_REVISION",
+ "LAYA_MAX_BATCH_TOKENS", "LAYA_JEV_STRICT")
+ _arms = [(dict(zip(_KN, ("4", "16384", "reviewed", "65536", "1"))),
+ dict(zip(_KN, ("4", "16384", "reviewed", "65536", "1")))),
({}, dict.fromkeys(_KN, ""))]
for _set, _expect in _arms:
proc = subprocess.run(["docker", "compose", "-f", "compose.yaml", "-f", "compose.http.yaml",