AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻譯準備中
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Laya-Pro is a local decision engine with typed choices, scores and yes/no decisions, retention-aware caching, local MCP tools and Python, TypeScript, Java and .NET integrations.
翻譯準備中
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Laya-Pro is a local AI decision engine for classification, scoring and yes/no questions.
Use it for ticket routing, moderation, guardrails and structured decisions in your own applications.
It runs on your hardware through Python or ONNX Runtime, with HTTP and local MCP interfaces.
Built on Laya, this fork adds configurable decision
retention, replay across devices and precision modes, and optimizations around inference.
The pretrained models remain upstream Laya checkpoints; the fork maintains its own code,
SDKs, documentation and measurements.檢視完整 README ↗Laya-Pro is a local AI decision engine for classification, scoring and yes/no questions. Use it for ticket routing, moderation, guardrails and structured decisions in your own applications. It runs on your hardware through Python or ONNX Runtime, with HTTP and local MCP interfaces.
Built on Laya, this fork adds configurable decision retention, replay across devices and precision modes, and optimizations around inference. The pretrained models remain upstream Laya checkpoints; the fork maintains its own code, SDKs, documentation and measurements.
Selected upstream changes are reviewed through Laya 0.4.6. The 12 October review records the adopted fixes, measured costs and deferred features.
Documentation · Integration · Benchmarks · Deployment
python -m pip install "laya-pro @ git+https://github.com/tgundhus/laya-pro.git"
# HTTP and MCP support
python -m pip install "laya-pro[serve,mcp] @ git+https://github.com/tgundhus/laya-pro.git"
Python 3.10–3.13. The distribution is laya-pro; imports and commands remain laya.
Install it separately from upstream laya, since both provide that import.
Source installation is supported until a Laya-Pro registry release is published.
For reproducible deployment, append a reviewed commit SHA to the Git URL.
The first model load downloads a checkpoint. Inference runs locally. For offline use, download checkpoints beforehand and pass their directories to the Router. Installation and platform notes.
from laya import DecisionCache, Router, decision_margins
questions = {
"department": {
"type": "choice",
"instructions": "Which department should handle this request?",
"criteria": {"billing": "invoices, payments and refunds",
"technical": "bugs, outages and access problems",
"other": "other requests"},
},
"urgent": {"type": "noul", "instructions": "Does this need attention today?"},
}
with DecisionCache("decisions.sqlite", ttl=7 * 86400, maxsize=100_000) as cache:
with Router(hooks=[cache]) as router:
state = "We were billed twice. Please refund the duplicate today."
result = router.predict(state, questions)
print(result["answers"]["department"]["choice"])
print(decision_margins(result))
router.predict(state, questions) # an exact repeat replays the stored decision
| Question | Returns |
|---|---|
choice | Label, probabilities per option and confidence |
score | Expected level on an ordered rubric and its distribution |
noul | Probability of yes |
Questions in a request share a forward pass. predict_batch handles multiple states;
predict_long handles documents beyond the context window. Routing selects an English,
multilingual or task-specific checkpoint. Explicit model and lang overrides are available.
The cache stores request hashes and result payloads, including option labels and probabilities. It does not store the original request text. Expiry prevents replay; physical deletion requires pruning and a policy for database files, journals and backups. A cached answer can still be wrong. Cache behavior and retention.
| Application | Interface |
|---|---|
| Python, in process | Router, Agent, ONNXAgent, typed schemas and prediction hooks |
| JavaScript / TypeScript, HTTP | HTTP client for your own laya-serve |
| JavaScript / TypeScript, in process | ONNX SDK |
| Java, in process | Java SDK |
| .NET, in process | .NET SDK |
| Editor or agent tools | MCP over stdio, local inference or your own HTTP server |
| Agent frameworks | LangChain / LangGraph, LlamaIndex, CrewAI |
The SDKs have different capabilities. Pro's persistent decision cache runs in the Python engine; HTTP clients and MCP can use that engine's cache. Native SDKs do not implement the same persistence policy. Capability table and examples.
Start a local HTTP server with laya-serve, then call POST /v1/systemone or
POST /v1/systemone/batch. Set these variables in the server's environment for a seven-day cache:
LAYA_CACHE_PATH=decisions.sqlite
LAYA_CACHE_TTL=604800
LAYA_CACHE_MAXSIZE=100000
The same cache variables apply to laya-mcp-server. Authentication, request bounds,
concurrency and offline setup are covered in the deployment guide.
The October CPU check used a pinned English checkpoint, fp32 and four threads. Median single inference was 571.5 ms; a SQLite repeat was 0.148 ms. All 12 answers agreed between serial and grouped batch execution. Workstation load was uncontrolled and this small check does not measure accuracy. Current results and methods.
These archived results used published checkpoints on an Apple M4 Max in September 2026, against Laya 0.3.20/0.3.21. They describe those runs, not a guarantee for newer versions or another machine. Method and raw results.
| Workload | Upstream run | Laya-Pro run |
|---|---|---|
| Repeated three-question ticket, CPU | 143.9 ms | 0.037 ms, memory cache |
| Repeated three-question ticket, MPS | 34.1 ms | 0.058 ms, memory cache |
| Stream with 70% repeats, MPS | 16.8 requests/s | 61.0 requests/s |
| 16 identical new requests, CPU | 16 forward passes, 1.26 s | 1 forward pass, 0.22 s |
| Shared-model new request, CPU | 152.7 ms | 151.8 ms |
| Cached decisions replayed after SQLite restart | — | 20,000 of 20,000 |
New requests are dominated by inference; cache speed depends on repeat frequency. Earlier parity checks covered 841 requests in 11 languages. Precision changes can change decisions, so validate fp16, bf16 or int8 on your own data before adopting them. The October review records current checks, fixes, measurements and verification limits separately from these archived results.
This version incorporates upstream 0.3.29 and selected correctness and integration changes reviewed through 0.4.2. The distribution remains 0.3.29 and retains Laya-Pro's English fallback for ambiguous Latin text. This is selected upstream coverage, not complete behavioral parity; the 10 October review records adopted changes, measurements and limits.
Validate accuracy and confidence on representative labelled data. Large choice sets, underspecified criteria and ordinal scores remain difficult. Replay improves repeatability, not accuracy; an expired, evicted or unavailable entry is computed again. See measured limits and the evaluation harness.
Contributing covers test suites, required lint and compile gates, and strict documentation builds. Changes should include a runnable regression check and measured evidence when they alter performance or numerical behavior.
Laya was created by Nandakishor M and developed by Convai Innovations. Laya-Pro's additions are maintained by Tobias Gundhus. The engine, checkpoints and fork are licensed under Apache 2.0. Laya-Pro is an independent fork, with no endorsement implied.