ホーム

Jev API の使い方

Jev は単一のエンドポイントを公開しています。状態と一連の質問を送ると、確率付きの型付き回答が返ってきます。最初の呼び出しに必要なすべてをここにまとめました。

1. エンドポイント

すべてのリクエストは https://api.typesafe.ai/v1/systemone への POST で、Bearer トークンで認証します。公式 SDK は TYPESAFE_API_KEY 環境変数からキーを読み取ります。

curl
curl -X POST https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jev-latest",
    "state": "Customer: I was charged twice and I am furious.",
    "questions": {
      "topic": {
        "type": "choice",
        "instructions": "What is the issue about?",
        "criteria": { "billing": "money problems", "bug": "broken product" }
      },
      "urgent": {
        "type": "noul",
        "instructions": "Escalate to a human now?"
      }
    }
  }'

2. リクエストボディ

3 つのフィールド:

3. 3 つの質問タイプ

choice — 1 つの選択肢を選ぶ

最大 255 個のラベル付き選択肢からなる criteria マップを与えます。Jev は勝者のキー、選択肢ごとの確率、信頼度を返します。

"topic": {
  "type": "choice",
  "instructions": "What is the primary issue?",
  "criteria": {
    "billing": "billing or payment problem",
    "bug": "the product is broken",
    "account": "login or access"
  }
}

score — 尺度上の位置

2–10 レベルの説明からなる順序付きの criteria 配列を与えます。Jev は(小数になりうる)スコアと分布全体を返します。

"severity": {
  "type": "score",
  "instructions": "How urgent is this?",
  "criteria": [
    "routine",
    "handle today",
    "urgent",
    "critical, about to churn"
  ]
}

noul — 較正済みの yes/no

criteria は不要 — 指示だけです。Jev は 0 から 1 の確率である noul を返します。

"escalate": {
  "type": "noul",
  "instructions": "Escalate to a human immediately?"
}

4. レスポンス

解決された model、answers マップ、トークン使用量が返ってきます:

{
  "model": "jev-1.13.0",
  "answers": {
    "topic":    { "type": "choice", "choice": "billing",
                  "confidence": 1.0,
                  "probabilities": { "billing": 1.0, "bug": 0.0, "account": 0.0 } },
    "severity": { "type": "score", "score": 3.0, "confidence": 1.0,
                  "legend": { "0": "routine", "3": "critical, about to churn" },
                  "probabilities": { "0": 0.0, "3": 1.0 } },
    "escalate": { "type": "noul", "noul": 0.8 }
  },
  "usage": { "input_tokens": 434, "output_tokens": 75 }
}

型が固定されているので、結果をプレーンなコードで分岐できます — if (answers.escalate.noul > 0.7) — 解析も正規表現も不要で、不正なレスポンスのリスクもありません。

5. 制限 & ベストプラクティス

もっと簡単な入口が欲しいですか?

公式の Jev アクセスはウェイトリスト制です。より簡単な、ホスト型の Jev 呼び出し方法 — 高いデモ上限、すぐ使えるエンドポイント、ウェイトリストなし — をご希望なら、メールアドレスと、何を作りたいかを教えてください。構築する前に需要を測っています。

コードを書く前に見てみたいですか? このページのすべての例はプレイグラウンドでライブに実行されます。公式キーと完全なドキュメントについては docs.typesafe.ai をご覧ください。

▶ プレイグラウンドで実行する料金を見る
Jev API の使い方 — エンドポイント、リクエスト形式 & 例 · Jev by TypeSafe AI