意思決定
テキスト・データ・画像についての名前付き質問への型付き回答
Decisionsモデルはstateを読み取り、指定した各質問に固定の回答形式で答えます。チケットの振り分け、コンテンツの評価、はい・いいえ判定、スコア付けに利用できます。Decisionsモデルの課金は入力トークンのみで、出力料金はありません。最新価格はサービスで確認してください。
| モデル | 入力 |
|---|---|
gemini-decision-1 | テキスト、画像、音声、動画、ファイル |
gpt-6-luna-decisions | テキストと画像 |
typesafe-jev-1.14 | テキストと画像 |
リクエスト
/v1/decisionsにPOSTリクエストを送信し、APIキーをAuthorizationヘッダーに入れます。
| フィールド | 種類 | 説明 |
|---|---|---|
model | 文字列 | Decisionsモデルです。既定値はgemini-decision-1となっています。 |
state | 文字列、オブジェクト、配列 | 必須。質問対象のテキスト、データ、メディアです。画像はimage_urlパーツとして配列に入れます。 |
questions | オブジェクト | 1件から50件の質問。各質問は1文字から64文字の英数字・アンダースコア・ハイフンによる固有名で指定します。optionsを送信しない限り必須です。 |
options | 配列 | 任意。ランク付けする2件から255件の選択肢をテキスト、またはvalueとdescriptionを持つオブジェクトで指定します。選択肢のランク付けを参照してください。 |
instructions | 文字列 | 任意。選択肢についての質問文です。既定値は「Which option fits the state best?」です。 |
question_name | 文字列 | 任意。answers内でのランキング質問の名前です。既定値はrankingです。 |
top_k | 整数 | 任意。返すランク付け済み選択肢の数を1から255の範囲で指定します。既定ではすべて返します。 |
assets | オブジェクト | 任意。状態から名前で参照できる名前付きPNG・JPEG画像です。 |
質問タイプ
各質問にはtype、任意のinstructions、取りうる回答を示すcriteriaがあります。
| 種類 | 基準 | 回答 |
|---|---|---|
noul | trueとfalseの説明を持つオブジェクト | noul:回答が真である確率。ほとんどのモデルではconfidence付き |
choice | 2から255の名前付き選択肢からなるオブジェクト | choiceに加え、各選択肢のprobabilitiesとconfidenceの値もあわせて返されます |
score | 最低から最高までの2~10段階のリスト | scoreは0から最終レベル番号までの値で、各レベルの確率加重平均のためレベル間に収まる場合があります。legend、各レベルのprobabilities、confidence付きです。 |
box | 基準なし。対象はinstructionsで記述します。typesafe-jev-1.14のみがボックス質問に回答します。 | 画像に対する割合で表したtop・bottom・left・rightを持つbox、およびconfidenceの値です |
モデルは質問への回答を拒否できます。その場合の回答は{ "type": "refusal" }として返ります。これは回答が「いいえ」ではなく、質問に答えなかったことを意味します。すべてのモデルがすべてのメディアパーツに対応するわけではなく、モデルが処理できないリクエストはステータス400で失敗します。
ランクオプション
一覧をランク付けするにはoptionsを送信します。SilentAPIはそれについて一つの選択質問を行い、rankingに可能性の高い順で並べたオプションを返し、トップの選択肢をchoiceに入れます。optionsは同じリクエスト内で他のquestionsと一緒に送ることもできます。
curl https://api.silentapi.com/v1/decisions \
-H "Authorization: Bearer $SILENTAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"state": "Order 1042 arrived two weeks late and the box was crushed. The customer wants it fixed today.",
"instructions": "What should support do first?",
"options": [
"apologize",
{ "value": "refund", "description": "Return the full payment." },
{ "value": "replace", "description": "Ship a new item by express." }
],
"top_k": 2
}'
{
"object": "decision",
"model": "gemini-decision-1",
"answers": { "ranking": { "type": "choice", "choice": "replace", "probabilities": { "replace": 0.62, "refund": 0.31, "apologize": 0.07 }, "confidence": 0.62 } },
"choice": "replace",
"confidence": 0.62,
"ranking": [
{ "rank": 1, "value": "replace", "probability": 0.62 },
{ "rank": 2, "value": "refund", "probability": 0.31 }
],
"usage": { "input_tokens": 96 },
"silentapi": {
"cost": 0.0000121,
"fallback": null,
"model": "gemini-decision-1",
"model_name": "Gemini Decision 1"
},
"cost": 0.0000121
}
例
curl https://api.silentapi.com/v1/decisions \
-H "Authorization: Bearer $SILENTAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-decision-1",
"state": { "tier": "business", "ticket": "Checkout shows a blank page after I click Pay." },
"questions": {
"is_bug": { "type": "noul", "instructions": "Is the customer reporting a defect?", "criteria": { "true": "Something is broken.", "false": "A question or a feature request." } },
"team": { "type": "choice", "instructions": "Which team owns this ticket?", "criteria": { "payments": "Checkout and billing.", "frontend": "Layout and rendering.", "account": "Login and profile." } },
"urgency": { "type": "score", "instructions": "How urgent is this ticket?", "criteria": ["Can wait", "This week", "Blocking sales now"] }
}
}'
応答には質問名ごとに一つの回答、入力トークン数、クレジットでのコストが含まれます。
{
"object": "decision",
"model": "gemini-decision-1",
"answers": {
"is_bug": { "type": "noul", "noul": 0.94, "confidence": 0.94 },
"team": {
"type": "choice",
"choice": "payments",
"probabilities": { "payments": 0.88, "frontend": 0.1, "account": 0.02 },
"confidence": 0.88
},
"urgency": {
"type": "score",
"score": 1.72,
"legend": { "0": "Can wait", "1": "This week", "2": "Blocking sales now" },
"probabilities": { "0": 0.04, "1": 0.2, "2": 0.76 },
"confidence": 0.76
}
},
"usage": { "input_tokens": 212 },
"silentapi": {
"cost": 0.0000265,
"fallback": null,
"model": "gemini-decision-1",
"model_name": "Gemini Decision 1"
},
"cost": 0.0000265
}
選択したモデルが利用できない場合、Decisionsのfallbacksを有効にしていれば、リクエストは別のDecisionsモデルに移動します。