شعار SilentAPI SilentAPI

القرارات

إجابات مكتوبة عن أسئلة مسماة حول نص أو بيانات أو صورة

يقرأ نموذج Decisions الحقل state ويجيب عن كل سؤال تسميه بنوع إجابة ثابت. استخدمه لتوجيه التذاكر وتقييم المحتوى وفحوص نعم أو لا والتسجيل. تُفوتر نماذج Decisions على رموز الإدخال فقط ولا يوجد سعر للإخراج. انظر الخدمات للأسعار الحالية.

النموذجالإدخال
الحقل gemini-decision-1نصوص وصور وصوت وفيديو وملفات
gpt-6-luna-decisionsنصوص وصور
الحقل typesafe-jev-1.14نصوص وصور

الطلب

أرسل طلب POST إلى /v1/decisions مع مفتاح واجهة البرمجة في ترويسة Authorization.

الحقلالنوعالوصف
الحقل modelالنوع stringنموذج Decisions. الافتراضي هو الحقل gemini-decision-1.
الحقل stateنص أو كائن أو مصفوفةمطلوب. النص أو البيانات أو الوسائط التي تدور حولها الأسئلة. توضع الصور في مصفوفة كأجزاء image_url.
الحقل questionsالنوع objectمن ١ إلى ٥٠ من الأسئلة، لكل منها اسم خاص به من ١ إلى ٦٤ من الأحرف والأرقام والشرطات السفلية أو الواصلات. مطلوب ما لم ترسل الحقل options.
الحقل optionsالنوع arrayاختياري. من ٢ إلى ٢٥٥ من الخيارات للترتيب، كنص أو ككائنات تحتوي على value وdescription. انظر ترتيب الخيارات.
الحقل instructionsالنوع stringاختياري. السؤال المطروح حول الخيارات. الافتراضي هو "Which option fits the state best?"
question_nameالنوع stringاختياري. اسم سؤال الترتيب في answers. الافتراضي هو ranking.
top_kالنوع integerاختياري. عدد الخيارات المرتبة المطلوب إرجاعها، من ١ إلى ٢٥٥. والافتراضي إرجاعها كلها.
الحقل assetsالنوع objectاختياري. صور PNG أو JPEG مسماة يمكن للحالة الإشارة إليها بالاسم.

أنواع الأسئلة

لكل سؤال type والحقل instructions اختياري وcriteria تصف الإجابات الممكنة.

النوعالمعاييرالإجابة
الحقل noulكائن يحتوي على وصفي true وfalseالحقل noul، أي احتمال أن تكون الإجابة صحيحة، إضافة إلى confidence في معظم النماذج
الحقل choiceكائن من ٢ إلى ٢٥٥ من الخيارات المسماةقيمة الحقل choice المُرجعة، إضافة إلى probabilities لكل خيار من الخيارات وconfidence لدرجة الثقة
الحقل scoreقائمة من ٢ إلى ١٠ من المستويات من الأدنى إلى الأعلىالحقل score من ٠ إلى فهرس المستوى الأخير، أي المتوسط المرجح بالاحتمالات للمستويات، فقد يقع بين المستويات، إضافة إلى legend وprobabilities لكل مستوى وconfidence
الحقل boxلا شيء، صِف الهدف في الحقل instructions. فـ الحقل typesafe-jev-1.14 وحده يجيب عن أسئلة المربعاتالحقل box مع top وbottom وleft وright ككسور من الصورة، إضافة إلى confidence

يمكن للنموذج رفض سؤال واحد. وتعود تلك الإجابة على شكل { "type": "refusal" }، أي أن السؤال لم يُجب عنه وليس أن الإجابة لا. وليست كل النماذج تقبل كل أجزاء الوسائط، والطلب الذي لا يستطيع النموذج خدمته يفشل بالحالة ٤٠٠.

خيارات الترتيب

أرسل الحقل 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.