This version of the module is deprecated: 项目已停止维护,不再推荐使用。
Constrained decoding core for MoonBit LLM tooling: compile regex / JSON-Schema into automata and token masks. A MoonBit port of the core ideas of outlines (upstream: dottxt-ai/outlines, Apache-2.0).
面向 LLM 结构化输出的约束解码核心库 —— outlines 核心思路的 MoonBit 移植。
// moon add outlineuser/moon_outlines(发布后)
let machine = @regex.compile("\"(yes|no)\"")
match machine {
Ok(m) => {
println(m.accepts("\"yes\"")) // true
println(m.accepts("\"maybe\"")) // false
}
Err(msg) => println("compile error: " + msg)
}moon check # 类型检查
moon test # 运行测试
moon fmt # 格式化
moon run cmd/main # 演示 CLIregex/ 正则子集解析(AST + 递归下降)+ Thompson NFA + 全串匹配
cmd/main/ 演示 CLIInstall
Download zipConstrained decoding core for MoonBit LLM tooling: compile regex / JSON-Schema into automata and token masks. A MoonBit port of the core ideas of outlines (upstream: dottxt-ai/outlines, Apache-2.0).