Expand description
Rust inference for Laya, a non-autoregressive typed-decision model: a ModernBERT-large encoder plus an RL-trained decision head.
Give it a state (text or JSON) and a set of typed questions; it returns typed answers with calibrated probabilities in a single forward pass. It never generates text.
use laya::{Agent, Question};
use serde_json::json;
let agent = Agent::from_dir("models/laya-base", Default::default())?;
let answers = agent.system_one(
&json!("My card was charged twice for the same order."),
&[("department".into(), Question::choice("Which team owns this?", ["billing", "technical", "sales"]))]
.into_iter()
.collect(),
)?;
println!("{}", serde_json::to_string_pretty(&answers)?);Re-exports§
pub use config::AgentConfig;pub use config::EncoderConfig;pub use question::QType;pub use question::Question;
Modules§
- config
- Runtime config: the encoder architecture plus the agent’s own decoding settings.
- model
- The decision model: a frozen-architecture ModernBERT backbone plus the from-scratch
decision head (
DecisionModelinrl_common.py). - question
- Typed questions and their rendering into an encoder sequence.
Structs§
- Agent
- Meta
- Options
- How to place and run the model.
- Prompt
View - The exact sequence the encoder sees for one question, for inspection and debugging.
- Response
- Token
View - One token of the rendered sequence.
- Usage