首页 / 五分钟上手:你的第一次 Jev 调用

五分钟上手:你的第一次 Jev 调用

上手教程·By OpenJev 编辑部·更新于 2026-10-03·5 分钟

你需要从 console.typesafe.ai 拿一个 API key。然后就是一个 POST。下面是一个完整、可直接复制的例子,在一次调用里问了三种不同类型的问题。

1. 裸 API 调用

curl -X POST https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" -d @- <<'EOF'
{
  "state": "Our Stripe integration has been failing
            for 3 days and we can't ship any orders!",
  "model": "jev-latest",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which team should handle this",
      "criteria": {
        "billing":   "Payment issues",
        "technical": "Bugs / integration",
        "sales":     "Pricing questions"
      }
    },
    "is_urgent": {
      "type": "noul",
      "instructions": "Does this convey urgency?"
    },
    "frustration": {
      "type": "score",
      "instructions": "How frustrated is the customer",
      "criteria": ["Calm", "Frustrated", "Very angry"]
    }
  }
}
EOF

2. 返回

类型化答案,代码直接可用——不用解析、不用正则、没有"LLM 没按 JSON schema 来"的救火:

{
  "answers": {
    "department": {
      "choice": "technical",
      "probabilities": { "technical": 0.93, "billing": 0.05, "sales": 0.02 },
      "confidence": 0.88
    },
    "is_urgent":  { "noul": 0.999 },
    "frustration":{ "score": 1.62, "confidence": 0.79 }
  },
  "usage": { "input_tokens": 312 }
}

3. SDK

  • Python:pip install typesafe-sdk(需要 Python ≥ 3.10)。然后 TypeSafeClient().system_one(state=..., questions={...})——自动从环境读 TYPESAFE_API_KEY。
  • JavaScript:npm 上的 @typesafe-ai/sdk。
  • Agent skill:Claude Code 用户可装官方 skill:claude plugin install typesafe@typesafe-ai。

4. 首次调用清单

在相信输出之前:
  • state 要最小且相关——无关上下文会掉精度(context rot)。
  • 每个问题原子化:一个专家几秒能答完的事。
  • instructions 按字面写——模型不读言外之意。
  • 读置信度,而不只是答案——它是你的安全阀。

跑通之后,下一步是把它接进真实逻辑——就是 附代码的模式。