AI・機械学習
Decisions APIがパブリックベータ版になりました
Decisions API is in public beta (developers.openai.com)
要約
OpenAIは、テキストや画像を評価して型付けされた回答を返す新しいDecisions APIをパブリックベータ版でリリースしました。このAPIは、条件の真偽確率、固定セットからの選択、または評価基準に対するスコアを返します。これにより、コンテンツの分類、リクエストのルーティング、作業の優先順位付けなどが可能になります。現在、gpt-6-lunaモデルのみが利用可能です。
全文翻訳
Decisions APIは、テキスト、画像、またはその両方を評価し、Responses APIよりも10倍高速に型付けされた回答を返します。
条件が真である確率、固定セットからの選択、または評価基準に対するスコアを取得します。
これらの回答を使用して、アプリケーションでコンテンツを分類したり、リクエストをルーティングしたり、作業を優先順位付けしたりできます。
PlaygroundでDecisions APIを試して、コードを書く前に質問や入力で実験してください。
Decisions APIはパブリックベータ版であり、数週間以内にGA(一般提供)になると予想しています。
gpt-6-lunaが現在利用可能な唯一のモデルです。
専用のPOST /v1/decisionsエンドポイントを使用してください。
Decisions APIの仕組み
リクエストは3つの部分で構成されます。
モデル
リクエストを評価するモデル。現在、gpt-6-lunaのみがサポートされています。
入力
質問の共有証拠:テキスト文字列またはテキストと画像を含むユーザーメッセージ。
質問
各質問のタイプ、指示、および許可される選択肢またはスコアレベルを含む、評価する内容。
応答にはanswers配列が含まれます。
各質問に一意の名前を付けて、その回答を識別できるようにしてください。APIは応答でその名前をエコーします。
質問タイプを選択する
タイプ
使用方法
Main result predicate
視覚的な損傷や記事の関連性など、条件をチェックします。
probability: 条件が真である確率(0から1)。
choice
部門やコンテンツカテゴリなど、1つのオプションを選択します。
choice: 提供された値のいずれか。
score
問題の重大度など、順序付けられたレベルに対して入力を評価します。
score: レベルの確率加重平均。
choiceとscoreの両方が、離散的なオプションに対する確率を返します。
順序のないカテゴリ(部門など)にはchoiceを使用します。
重大度などの順序付けられたレベルにはscoreを使用します。これは、レベルの確率加重平均を計算して、レベル間に収まるスコアを生成します。
アプリケーションがこれらの回答タイプのいずれかを必要とする場合は、Decisionsを使用してください。
独自のJSONスキーマ(抽出フィールドや説明の記述など)に従うオブジェクトを生成する必要がある場合は、Responses APIのStructured Outputsを使用してください。モデルに引数付きでツール呼び出しを要求する必要がある場合は、function callingを使用してください。
画像に視覚的な損傷がないかチェックする
述語質問を使用して、製品写真に視覚的な損傷がないかチェックします。
このリクエストは、画像を指示と組み合わせて、ひび割れ、破れ、またはへこみがないかを確認します。
DentCancellationAnswer relevanceDoes this item have a dent?probability1.00“Please cancel my subscription before the next renewal.Can I switch to annual billing and keep my current plan?I don’t need this anymore. How do I stop future charges?probability1.00QuestionCan I return an item after 30 days?AnswerReturns are accepted within 30 days of delivery. After that, items aren’t eligible for a refund.Start a return from the Orders page in your account.Standard shipping takes three to five business days.probability0.90 12345678910111213141516171819202122IMAGE_BASE64="$(base64 < product.png | tr -d '\r\n')" curl https://api.openai.com/v1/decisions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @- <<JSON { "model": "gpt-6-luna", "input": [{ "role": "user", "content": [ {"type": "input_text", "text": "Inspect the product in this photo."}, {"type": "input_image", "image_url": "data:image/png;base64,$IMAGE_BASE64"} ] }], "questions": [{ "type": "predicate", "name": "visible_damage", "instructions": "Does the product have visible damage, such as a crack, tear, or dent? Ignore shadows and damage to the packaging." }] } JSON 例示的な応答の一部: 123456789{ "answers": [ { "type": "predicate", "name": "visible_damage", "probability": 0.92 } ] } 確率は、条件が真であるというモデルの推定値です。
これを使用して、選択したしきい値に基づいて写真をレビューのためにフラグ付けします。
画像はインラインbase64データURLである必要があります。
ホストされたHTTPまたはHTTPS画像URLおよびfile_id入力はこのエンドポイントではサポートされていません。
input_textとinput_imageの部分をユーザーメッセージで組み合わせることで、指示やその他のコンテキストとともに画像を評価できます。
固定オプションから選択する
選択質問は、提供されたオプションから1つの値を選択します。
各オプションが適用される状況を説明する、明確な値と説明を使用してください。
DrivingTeam routingDocument typeWhich lane should the car choose?123Lane 10.03Lane 20.94Lane 30.03“I was charged twice for this month. Can you refund the extra payment?Every CSV export fails with an error, even after I refresh the page.I lost my phone and can’t get past two-step verification.Billing1.00Technical support0.00Account access0.00NORTHLINE STUDIO № 1042InvoiceBilled to Cedar & Co.Design services$1,200.00Amount due$1,200.00Payment due October 21NORTHLINE STUDIO № 6853Payment receivedThank you for your purchase.Design services$1,200.00Total paid$1,200.00Visa ending in 4242 · ApprovedNORTHLINE STUDIO 01 / 03Services agreementBetween Northline Studio and Cedar & Co.The provider agrees to deliver design services for a term of twelve months.Provider signatureClient signatureInvoice1.00Receipt0.00Contract0.00 このリクエストは、顧客の苦情をルーティングします。
123456789101112131415161718curl https://api.openai.com/v1/decisions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6-luna", "input": "I was charged twice for my order.", "questions": [{ "type": "choice", "name": "department", "instructions": "Which department should handle this complaint?", "choices": [ {"value": "billing", "description": "Payments, invoices, and refunds."}, {"value": "technical", "description": "Problems using the product."}, {"value": "shipping", "description": "Delivery and tracking."}, {"value": "other", "description": "Requests outside these categories."} ] }] }' 例示的な応答の一部: 12345678910111213141516{ "answers": [ { "type": "choice", "name": "department", "choice": "billing", "probabilities": [ { "value": "billing", "probability": 0.95 }, { "value": "technical", "probability": 0.02 }, { "value": "shipping", "probability": 0.01 }, { "value": "other", "probability": 0.02 } ], "confidence": 0.93 } ] } 回答のchoiceフィールドには、提供された値(この場合は"billing")が含まれます。
また、オプションのprobabilities配列とconfidenceフィールドも含まれます。
しきい値の設定については、回答の解釈を参照してください。
カテゴリがすべての可能な入力をカバーしない場合は、"other"のようなフォールバックオプションを含めてください。
アプリケーションはその結果を一般的なレビューキューに送信できます。
評価基準でスコアリングする
スコア質問は、順序付けられたレベルに対して入力を評価します。
各レベルの基準を定義し、最低から最高まで並べます。
PackageUrgent requestHow damaged is this package?0.00/ 20 · None1 · Minor2 · MajorNo damage1.00Minor damage0.00Major damage0.00“Could you add a dark mode? It would be helpful when I work at night.CSV exports keep failing for one teammate. The rest of our team can still export.Checkout is failing for every customer. We haven’t processed an order in 20 minutes.0.00/ 20 · Low1 · Medium2 · HighLow1.00Medium0.00High0.00 12345678910111213141517curl https://api.openai.com/v1/decisions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6-luna", "input": "Export fails in Safari but works in Chrome.", "questions": [{ "type": "score", "name": "severity", "instructions": "How severe is this issue?", "levels": [ {"label": "Cosmetic", "description": "Appearance only; no lost functionality."}, {"label": "Workaround available", "description": "A task fails, but another way works."}, {"label": "Fully blocked", "description": "A task fails with no workaround."} ] }] }' 例示的な応答の一部: 123456789101112131415{ "answers": [ { "type": "score", "name": "severity", "score": 1.1, "probabilities": [ { "value": 0, "label": "Cosmetic", "probability": 0.1 }, { "value": 1, "label": "Workaround available", "probability": 0.7 }, { "value": 2, "label": "Fully blocked", "probability": 0.2 } ], "confidence": 0.55 } ] } レベルのインデックスは0から始まります。