typesafe-ai
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBuild with TypeSafe
使用 TypeSafe 构建
TypeSafe makes units of AI intelligence usable like programming primitives: small
judgments you can compose into larger capabilities. Its System One models return
fast, focused judgments that software can consume directly. Jev is TypeSafe's
flagship and first System One model. It understands natural language and returns
typed answers and probabilities rather
than generating text or reasoning explanations. Code owns the workflow; the model
supplies programmable common sense where ordinary code needs semantic understanding.
TypeSafe 让 AI 智能单元像编程原语一样可用:你可以把它们组合成更大的能力。其 System One 模型 返回快速、聚焦的判断,软件可以直接消费。Jev 是 TypeSafe 的旗舰模型,也是首个 System One 模型。它理解自然语言,返回类型化答案和概率,而不是生成文本或推理解释。代码拥有工作流;模型在普通代码需要语义理解的地方提供可编程的常识。
Read the live docs
阅读实时文档
The live TypeSafe docs are the source of truth. Read them as part of the task.
This skill gives direction; the docs carry current concepts, prompting guidance,
API contracts, SDK usage, models, limits, and worked examples.
- Start with the documentation index to discover relevant pages and cookbooks. Use targeted reads rather than loading the entire site.
- Mintlify serves Markdown by appending to a page path, for example how to build with TypeSafe. Follow links from the index; convert extensionless documentation page links to
.mdwhen useful. Resolve relative links against.md.https://docs.typesafe.ai - Before writing an integration, read the current API or chosen SDK page and the question guidance relevant to the design. For a new workflow, also inspect the closest cookbook: it often shows a better decomposition than a generic classifier.
- If the index is unavailable, use the direct links below or the site's navigation. If Markdown fetching fails, try the normal page. If live access is unavailable, use available local docs or installed SDK types, state that limitation, and avoid inventing version-dependent details.
| Task | Start here; follow the relevant details |
|---|---|
| Understand the programming model | System One, building guide |
| Explore what to build | Use-case map, then relevant cookbooks from the index |
| Prepare inputs and questions | State, primitives, then the chosen primitive's page |
| Decide how to handle uncertainty | Confidence |
| Write API code | HTTP API, Python SDK, or JavaScript SDK |
| Update an older integration | Migration guide and the installed SDK's current reference |
TypeSafe 实时文档是事实来源。请将其作为任务的一部分阅读。 本 skill 提供方向;文档承载当前概念、提示词指南、API 契约、SDK 用法、模型、限制和示例。
- 从 文档索引 开始,发现相关页面和 cookbook。使用定向阅读,而非加载整个站点。
- Mintlify 通过在页面路径后追加 提供 Markdown,例如 如何使用 TypeSafe 构建。从索引中跟随链接;在有用时将无扩展名的文档页面链接转换为
.md。相对链接请基于.md解析。https://docs.typesafe.ai - 在编写集成之前,请阅读当前 API 或所选 SDK 页面,以及与设计相关的问题指南。对于新工作流,还要查看最接近的 cookbook:它通常比通用分类器展示更好的分解方式。
- 如果索引不可用,请使用下方直接链接或站点导航。如果 Markdown 获取失败,请尝试普通页面。如果无法实时访问,请使用可用的本地文档或已安装的 SDK 类型,说明该限制,并避免臆造依赖版本的细节。
| 任务 | 从这里开始;关注相关细节 |
|---|---|
| 理解编程模型 | System One, 构建指南 |
| 探索可以构建什么 | 用例地图,然后是索引中的相关 cookbook |
| 准备输入和问题 | 状态, 原语,然后是所选原语的页面 |
| 决定如何处理不确定性 | 置信度 |
| 编写 API 代码 | HTTP API, Python SDK, 或 JavaScript SDK |
| 更新旧集成 | 迁移指南 与已安装 SDK 的当前参考 |
Find the useful shape
找到有用的形态
Start from the behavior the user wants: what will the application show, select,
change, or hand off? Work backward to the judgments it needs. Keep known rules,
calculations, exact lookups, and execution in code. Preserve the user's chosen stack
and scope; add TypeSafe where semantic understanding helps.
When brainstorming or choosing an architecture, consider more than classification.
The patterns below are starting points: combine primitives around the user's goal,
including ideas that do not fit an established recipe.
- Route and fill known arguments. A request can select a handler and its typed parameters. Ask useful branch-specific questions up front and consume only the relevant answers. Explore function calling and speculative fan-out.
- Select instead of generate. Find candidate values or source spans in code, use a judgment to select the intended one, then copy or normalize it. Code can also assemble source text into a formatted document or reading guide. Explore value extraction and structure recovery.
- Find and judge evidence. Retrieve candidates, compare their relevance to a query, and select useful context. Explore reranking and hierarchical classification.
- Turn judgments into reusable data. Score dimensions once, then let code or user controls change weights, thresholds, rankings, and views. With labeled outcomes, those signals can become classical ML features. Explore composite scoring and feature discovery.
- Verify and escalate. Check specific claims or fields against their evidence; send uncertain or failing cases to a person or reasoning model. Explore citation checks and extraction cascades.
- Respond to changing state. Code can retain goals and observations while fresh judgments guide the next bounded step. Keep inferred state distinct from observed facts, and check freshness before applying a result to a changed situation.
For open-ended requests, offer the few directions that best serve the user's goal
and recommend a starting point. For a concrete request, choose the relevant pattern
and build; a brainstorm is not a mandatory detour.
从用户想要的行为出发:应用程序将显示、选择、更改或移交什么?反向推导它需要的判断。将已知规则、计算、精确查找和执行保留在代码中。保留用户选定的技术栈和范围;在语义理解有帮助的地方添加 TypeSafe。
在头脑风暴或选择架构时,请考虑比分类更多的东西。下面的模式是起点:围绕用户目标组合原语,包括那些不符合既有配方的想法。
- 路由并填充已知参数。 一个请求可以选择处理器及其类型化参数。提前提出有用的分支特定问题,只消费相关答案。探索 函数调用 和 推测性扇出。
- 选择而非生成。 在代码中找到候选值或源文本片段,用判断选择预期的一个,然后复制或规范化它。代码还可以把源文本组装成格式化文档或阅读指南。探索 值抽取 和 结构恢复。
- 找到并判断证据。 检索候选,比较它们与查询的相关性,选择有用上下文。探索 重排序 和 层次分类。
- 将判断转化为可复用数据。 对维度进行一次评分,然后让代码或用户控件改变权重、阈值、排名和视图。有了标注结果,这些信号可以成为经典机器学习特征。探索 复合评分 和 特征发现。
- 验证并升级。 对照证据检查具体声明或字段;将不确定或失败的情况交给人工或推理模型。探索 引用检查 和 抽取级联。
- 响应变化的状态。 代码可以保留目标和观察,同时新的判断指导下一个有界步骤。将推断状态与观察到的事实区分开,并在将结果应用于已变化的情况之前检查新鲜度。
对于开放式的请求,提供最能服务用户目标的几个方向,并推荐一个起点。对于具体的请求,选择相关模式并构建;头脑风暴不是强制绕行。
Design the judgments
设计判断
Choose by what the answer means, then read the relevant primitive page:
| Need | Primitive | Important distinction |
|---|---|---|
| One of a defined set | Choice | Picks one option; its distribution compares competing options |
| Whether a condition holds | Noul | Probability of yes; no separate confidence; use one per label when several may apply |
| Degree along a described dimension | Score | Probability-weighted position on ordered levels; use comparable per-item Scores for graded ranking |
Give each question enough relevant state to answer: source text, identities,
relationships, policies, and current facts. Prefer named JSON fields when context
has several parts. Put the judgment in instructions and define its possible
answers in criteria. Question IDs are for code and are not sent to the model;
include complete meaning in the question. Reference nested state with backticked
paths such as .
ticket.messages[0].textAsk one narrow, coherent judgment per question. Split independently useful dimensions,
without destroying the relationship being judged. A bounded action selection or
contextual interpretation is valid; atomic does not mean literal fact extraction
or a one-sentence limit. Strings work for simple questions. Use structured objects
or arrays when definitions, contrasts, exclusions, or examples clarify instructions
or criteria. Score levels must describe concrete situations and stand on their own.
Keep the needed answers available. Include a no-match outcome when nothing may fit;
use a separate presence judgment when it is independently useful. For source-value
selection, check candidate coverage: the model cannot choose an omitted value.
根据答案的含义来选择,然后阅读相关原语页面:
| 需求 | 原语 | 重要区别 |
|---|---|---|
| 从定义集合中选一个 | Choice | 选择一个选项;其分布比较竞争选项 |
| 条件是否成立 | Noul | “是”的概率;没有独立置信度;当多个标签可能适用时,每个标签使用一个 |
| 沿描述维度的程度 | Score | 有序级别上的概率加权位置;对分级排序使用可比较的逐项 Scores |
为每个问题提供足够相关的状态来回答:源文本、身份、关系、策略和当前事实。当上下文有多个部分时,优先使用命名的 JSON 字段。把判断放在指令中,并在标准中定义其可能的答案。问题 ID 供代码使用,不会发送给模型;在问题中包含完整含义。使用反引号路径引用嵌套状态,例如 。
ticket.messages[0].text每个问题只询问一个狭窄、连贯的判断。拆分独立有用的维度,但不要破坏被判断的关系。有界的动作选择或上下文解释是有效的;原子不意味着字面事实抽取或一句话限制。字符串适合简单问题。当定义、对比、排除或示例能澄清指令或标准时,使用结构化对象或数组。Score 等级必须描述具体情境并能独立成立。
保持所需答案可用。当可能没有匹配时,包含一个不匹配结果;当独立有用时,使用单独的存在性判断。对于源值选择,检查候选覆盖范围:模型无法选择被遗漏的值。
Compose and verify
组合与验证
Ask independent questions over the same state together, including useful
speculative questions. They run in parallel and cannot see one another's answers.
State each speculative premise explicitly; code consumes the applicable answers.
A second request is warranted when an earlier answer is needed to fetch evidence,
construct new state, or determine the next options. Extra questions still use tokens;
measure actual request budgets, cost, and end-to-end latency.
Use probabilities and confidence to guide behavior, with thresholds evaluated on
the user's data and consequences. Choice/Score confidence summarizes distribution
concentration, not overall workflow correctness or permission to act. A Noul near
0.5 means similar probability for yes and no, not medium intensity. Several
acceptable alternatives can also spread probability; low confidence need not
invalidate a harmless preference choice. Ignore uncertainty on unused branches.
Keep policy explicit and raw judgments reusable. Weighted scores suit compensating
preferences; an “any serious violation” rule needs separate conditions. Changing a
weight or display filter need not rerun inference when evidence and question meanings
are unchanged. Typed output guarantees the interface, not truth. System One models
are trained for calibrated decisions; validate their performance in the target domain.
Test representative cases and the resulting application behavior. For failures,
inspect the exact state, questions, candidates, answers, composition, and observed
outcome. Separate missing evidence, model errors, code errors, and service failures.
Treat cookbook thresholds and demo results as examples to evaluate, not universal
rules or permanent model limitations. Keep API credentials server-side in web apps.
在相同状态上一起询问独立问题,包括有用的推测性问题。它们并行运行,无法看到彼此的回答。明确陈述每个推测性前提;代码消费适用的答案。当需要先前的答案来获取证据、构造新状态或确定下一个选项时,才应该进行第二次请求。额外的问题仍然使用 token;衡量实际的请求预算、成本和端到端延迟。
使用概率和置信度引导行为,阈值在用户数据和后果上进行评估。Choice/Score 的置信度总结了分布集中度,而非整个工作流的正确性或许可。接近 0.5 的 Noul 表示“是”和“否”概率相似,而不是中等强度。多个可接受的备选方案也可能分散概率;低置信度不一定要使无害的偏好选择失效。忽略未使用分支上的不确定性。
保持策略显式,原始判断可复用。加权分数适合补偿性偏好;而“任何严重违规”的规则需要单独条件。当证据和问题含义不变时,改变权重或显示过滤不需要重新运行推理。类型化输出保证的是接口,而非事实。System One 模型经过校准决策训练;请在目标领域验证其表现。
测试代表性案例以及由此产生的应用行为。对于失败,检查确切的状态、问题、候选、答案、组合和观察到的结果。区分缺失证据、模型错误、代码错误和服务故障。把 cookbook 中的阈值和演示结果当作需要评估的示例,而非通用规则或永久模型限制。在 Web 应用中,API 凭据保持在服务端。