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.

docs(agent,onnx): say how predict_long combines the truncation keys

Som Tripathia756db498598
diff --git a/laya/agent.py b/laya/agent.py
index 3ff2af34..4cfe8be4 100644
--- a/laya/agent.py
+++ b/laya/agent.py
@@ -1172,6 +1172,13 @@ class Agent(HookRegistry):
the `N` a start hook rewrote them to), and `0` when a start hook answered the document, or
left no states to score, before any window was read -- on either path, so a cached answer
never reads as a window the model read.
+
+ Across several windows the truncation keys are combined like every other `usage` field:
+ `truncated`, `state_tokens` and `state_tokens_dropped` are summed (so `truncated` is the
+ number of windows that were cut, and the token counts include the overlap), and
+ `truncated_questions` is the last window's list. A window is cut when it is larger than
+ the room a question's head leaves, from a `window` above the default or a start hook that
+ narrows `max_len` / `head_max_len`. Test `usage["truncated"] > 0` here, not `is True`.
"""
if aggregate != "auto":
raise ValueError("predict_long: only aggregate='auto' is supported")
diff --git a/laya/onnx_agent.py b/laya/onnx_agent.py
index 49ef3a02..e3ab8b0e 100644
--- a/laya/onnx_agent.py
+++ b/laya/onnx_agent.py
@@ -416,7 +416,9 @@ class ONNXAgent(HookRegistry):
hooks_timeout: Override the agent's `hooks_timeout` for this call.
Returns a single result dict, the same shape as `system_one`, with `usage["windows"]`
- added.
+ added. Across several windows the truncation keys are summed or carried the same way as
+ in `Agent.predict_long`: `truncated` is a window count and `truncated_questions` is the
+ last window's list.
"""
from .agent import _start_evidence, _with_start_probe
from .hooks import aggregate_usage