Laya (लय)
Fast, non-autoregressive System 1 decision engine with mathematically calibrated probabilities.
Laya lets you evaluate typed questions (choice, score, noul) over any state (text, email, ticket, or JSON document) in a single forward pass (~33–38 ms on GPU). It produces structured decision outputs and calibrated confidence scores without text generation, token streaming, or hallucinations.
Compatible with RL Agent models on Hugging Face.
Installation
pip install laya
Quickstart
import laya
# 1. Load the model from Hugging Face Hub (auto-downloads weights)
agent = laya.load("convaiinnovations/rl-agent")
# 2. Provide any state (string or dictionary)
state = {
"from": "user@acme.com",
"subject": "Duplicate charge on invoice #4411",
"body": "Hi, we were billed twice for March. Please refund the duplicate today or we will cancel our plan."
}
# 3. Define your typed questions
questions = {
# choice: categorical selection with probabilities & confidence
"department": {
"type": "choice",
"instructions": "Which department should handle this email?",
"criteria": {
"billing": "invoices, payments, refunds",
"technical": "bugs, outages, system errors",
"sales": "pricing, new contracts",
"other": "everything else"
}
},
# score: placement on an ordinal rubric
"urgency": {
"type": "score",
"instructions": "How urgent is this request?",
"criteria": ["not urgent", "soon", "critical deadline or blocking issue"]
},
# noul: calibrated boolean probability P(true)
"churn_risk": {
"type": "noul",
"instructions": "Does the user threaten to cancel or leave?"
},
"is_phishing": {
"type": "noul",
"instructions": "Is this email a phishing or scam attempt?"
}
}
# 4. Run all questions in ONE single forward pass (~35 ms on GPU)
result = agent.predict(state, questions)
answers = result["answers"]
print("Department :", answers["department"]["choice"])
# -> billing (confidence: 0.94)
print("Urgency :", answers["urgency"]["score"])
# -> 1.84 / 2.0
print("Churn Risk :", answers["churn_risk"]["noul"])
# -> 0.892 (89.2% probability)
print("Phishing :", answers["is_phishing"]["noul"])
# -> 0.008 (0.8% probability)
Automated Confidence Gating
Because Laya's probabilities are trained with strictly proper scoring rules (RLCD), confidence scores are statistically meaningful:
dept = answers["department"]["choice"]
conf = answers["department"]["confidence"]
if conf >= 0.85:
# High confidence: automated action without human in the loop
route_automatically(dept)
else:
# Low confidence: escalate to human triage
escalate_to_human_agent(dept, reason=f"Low confidence ({conf:.2f})")
Decision Primitives
| Primitive | Output | Use Cases |
|---|---|---|
choice |
Top label, probabilities per option, confidence | Department routing, intent classification, topic categorization |
score |
Expected level on ordinal rubric, distribution, confidence | Frustration level, ticket urgency, harm severity |
noul |
Calibrated probability $P(\text{true}) \in [0.0, 1.0]$ | Phishing detection, spam filtering, jailbreak detection, churn risk |
Live Demo & Resources
- Hugging Face Model: convaiinnovations/rl-agent
- Interactive Web Demo: convaiinnovations/rl-agent-demo
License
Apache 2.0. Developed by Convai Innovations.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file laya-0.1.1.tar.gz.
File metadata
- Download URL: laya-0.1.1.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05edb4b18b3f9b0b924311e342e54f8075c3ce79d934e8872915b69b3f5de9d7
|
|
| MD5 |
89252940a06813faf6a309491c19fcd8
|
|
| BLAKE2b-256 |
bcfd50f2e28f17c4595e66c7848e1c41adf62825d161128982d1a98b3d89ad66
|
File details
Details for the file laya-0.1.1-py3-none-any.whl.
File metadata
- Download URL: laya-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84599282c5115d2968970988002db7cadfaf79d348a79bf3cf7b6fd537b97ca0
|
|
| MD5 |
f715732213360d4ef6d6fdee4ebbe8ca
|
|
| BLAKE2b-256 |
f264b438cf1887008ba9d05a7276cd1c39773a7402ea408256f4705f93b4e689
|