跳到正文
原文
rohanpaul_ai· @rohanpaul_ai · X·· 4 小时前AI 评分45

TypeLLM 开源:JSON Schema 驱动的类型安全 LLM 工作流

AI 导读

开源项目 TypeLLM 发布,可将整个多步 AI 工作流定义为一个 JSON Schema,并在单次 API 调用中作为依赖图执行,输出类型安全保证。它基于 SGLang 实现约束解码,对枚举、布尔、数字等字段限制候选 token,并复用缓存前缀,即使使用未经修改的 Qwen checkpoint 也能获得 schema 保证的输出。

正文 · 原文

Open source meets type-safe AI, with TypeLLM.

Chat models give you a reply and decision models give you a choice, but TypeLLM is built to run your whole workflow in one API call.

Most production pipelines need something in between: several typed answers, some depending on others, a few that should exist only under certain conditions.

TypeLLM takes that whole shape as one JSON Schema and executes it as a dependency graph over a single shared context.

Typed LLM outputs, built in the open.

You can get schema-guaranteed outputs from a stock Qwen checkpoint without touching its weights.

The guarantee comes from how the requests are built and decoded.

TypeLLM sits on SGLang and turns a JSON Schema into constrained decoding: one scored token for an enum or boolean, bounded digits for numbers, and a dependency graph that reuses cached prefixes.

So a field can’t return a value outside its enum, because the decoder only considers the allowed candidates.

来源:rohanpaul_ai · x.com