문서

고급: 구조

instructions, Choice 선택지, Score 레벨, Noul criteria 모두 JSON 구조를 받습니다.

System One 모델은 구조를 이해하도록 학습되었습니다.

구조가 허용되는 곳

다음 필드는 모두 EntryType입니다.

필드 적용 대상 허용되는 형태
instructions Choice, Score, Noul string, object, array, 또는 null
criteria 값(선택지 설명) Choice string, object, array, 또는 null
criteria 항목(레벨 설명) Score string, object, array, 또는 null
criteria.true와 criteria.false Noul string, object, array, 또는 null

언제 질문을 구조화하는가

  • 명확성에 도움이 될 때. 질문에 여러 부분이 있을 때, 이를 JSON 형태로 두면 키에 이름이 붙어 있어 명확성에 도움이 됩니다.
  • 질문에 보조 데이터가 필요할 때. 스키마, 분류 체계, 데이터베이스 행은 이미 JSON입니다. 문자열 템플릿으로 직렬화하는 대신 JSON을 그대로 사용하거나 관련 하위 필드를 전달하십시오.

구조화된 instructions

하나의 field 객체가 확인 대상 필드를 설명하고, 각 질문이 키로 이를 참조합니다. 같은 형태가 값을 검증하는 Noul, 후보 중 하나를 고르는 Choice, 값을 척도 위에 놓는 두 개의 Score를 구동합니다.

request
{
  "state": {
    "source_text": "Invoice #4471 issued March 3, 2026 to Beaver Dam Logistics for $12,840.00, net 30."
  },
  "questions": {
    "invoice_number_is_correct": {
      "type": "noul",
      "instructions": {
        "field": {
          "name": "invoice_number",
          "type": "string",
          "description": "The identifier printed on the invoice."
        },
        "extracted_value": "4471",
        "question": "Does `extracted_value` match the `field` as it appears in `source_text`?"
      }
    },
    "customer_name": {
      "type": "choice",
      "instructions": {
        "field": {
          "name": "customer_name",
          "type": "string",
          "description": "The organization the invoice was issued to."
        },
        "question": "Which option is the value of `field` in `source_text`?"
      },
      "criteria": {
        "Beaver Logistics": null,
        "Dam Logistics": null,
        "Beaver Dam Logistics": null,
        "Beaver": null,
        "Dam": null
      }
    },
    "amount_due": {
      "type": "score",
      "instructions": {
        "field": {
          "name": "amount_due",
          "type": "number",
          "unit": "USD",
          "description": "The total the invoice asks to be paid."
        },
        "question": "How large is the `field` value in `source_text`?"
      },
      "criteria": [
        "Under $1,000",
        "$1,000 to $10,000",
        "$10,000 to $100,000",
        "$100,000 to $1,000,000",
        "Over $1,000,000"
      ]
    },
    "payment_terms": {
      "type": "score",
      "instructions": {
        "field": {
          "name": "payment_terms",
          "type": "integer",
          "unit": "days",
          "description": "Days allowed for payment, from terms such as \"net 30\"."
        },
        "question": "How many days does the `field` in `source_text` allow for payment?"
      },
      "criteria": [
        "Due on receipt",
        "Net 10",
        "Net 30",
        "Net 60",
        "Net 90"
      ]
    }
  }
}

코드에서는 잠재적인 레코드를 순회하며 필드마다 이런 질문을 하나씩 만들어 하나의 호출로 보낼 수 있습니다. SDE 캐스케이드 쿡북이 이와 비슷한 작업을 합니다.

배열도 작동합니다. 지시가 확인하거나 비교할 항목들의 목록일 때 배열을 사용하십시오.

"instructions": {
  "question": "Does the claimed sender identity conflict with the sending domain?",
  "compare": ["ticket.sender.display_name", "ticket.sender.email"],
  "focus": "Compare the named organization with the email domain."
}

구조화된 Choice 선택지

Choice 선택지 설명도 구조화된 객체가 될 수 있습니다.

경계 명확화를 위한 JSON 루브릭

request
{
  "state": "I ordered the standing desk two weeks ago and tracking still says label created. Was I even charged?",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": {
        "question": "Which team should handle this message?",
        "focus": "Classify the customer's primary request, not every topic mentioned."
      },
      "criteria": {
        "billing": {
          "what": "Charges, invoices, refunds, or subscriptions",
          "not_for": "Order tracking or account access",
          "examples": [
            "I was charged twice",
            "Where is my refund?"
          ]
        },
        "orders": {
          "what": "Order status, delivery, cancellation, or returns",
          "not_for": "Charges or account access",
          "examples": [
            "Where is my package?",
            "Cancel my order"
          ]
        },
        "account": {
          "what": "Login, password, profile, or security",
          "not_for": "Charges or delivery",
          "examples": [
            "I can't log in",
            "Change my email"
          ]
        }
      }
    }
  }
}

이 예시는 각 선택지가 무엇을 다루고 무엇을 다루지 않는지 모델에 알려줍니다. 선택지 간의 경계를 날카롭게 만듭니다.

분류 체계 따라가기

깊은 분류 체계로 분류하려면 레벨마다 Choice를 하나씩 질문하고 코드에서 트리를 따라가십시오. 각 단계에서 선택지는 현재 노드의 자식이고, 각 선택지의 값은 그 자식의 트리입니다. 이렇게 하면 모델이 어떤 가지 아래에 무엇이 있는지 확인한 뒤 확정할 수 있으며, 이는 항목이 가지 이름만으로는 분명하지 않은 리프에 속할 때 중요합니다.

여기서 상태는 상품 목록이고 첫 질문은 최상위 부서를 고릅니다.

request
{
  "state": "32oz plastic bottle with a flip straw lid. Fits most bike cages.",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which top-level department does this product belong to?",
      "criteria": {
        "Sporting Goods": {
          "Cycling": [
            "Bike Bottles & Cages",
            "Bike Lights",
            "Helmets"
          ],
          "Fitness": [
            "Yoga Mats",
            "Resistance Bands"
          ],
          "Outdoor": [
            "Tents",
            "Sleeping Bags",
            "Hydration Packs"
          ]
        },
        "Home & Kitchen": {
          "Drinkware": [
            "Water Bottles",
            "Travel Mugs",
            "Tumblers"
          ],
          "Cookware": [
            "Pots & Pans",
            "Bakeware"
          ]
        },
        "Baby & Toddler": [
          "Sippy Cups",
          "Bottle Warmers",
          "Bibs"
        ]
      }
    }
  }
}

이 병은 두 부서 아래에 모두 들어갈 법합니다. 하위 트리를 보여주면 모델이 Sporting Goods > Cycling > Bike Bottles & Cages와 Home & Kitchen > Drinkware > Water Bottles가 둘 다 존재함을 확인하고, 자전거 케이지에 대한 목록의 강조와 일상적인 음용구를 비교해 저울질할 수 있습니다. 이 답변의 probabilities는 그 분할이 두 가지를 모두 탐색할 만큼 근접한지 알려줍니다.

부서가 선택되면, 그 부서의 자식을 선택지로, 그 하위 트리를 값으로 하여 다음 Choice를 질문하고, 리프에 도달할 때까지 반복하십시오. 코드에서는 중첩 딕셔너리를 순회하는 루프가 될 수 있으며, 각 질문의 criteria는 단순히 현재 노드입니다. 계층적 분류 쿡북은 확률이 근접할 때 여러 후보 경로를 살려 두는 빔 서치를 포함해, 이와 유사한 트리 순회의 예를 보여줍니다.

구조화된 Score 레벨

Score criteria 배열의 각 항목은 객체가 될 수 있습니다.

request
{
  "state": "Fixed the null check in the payment handler. Also refactored the retry loop while I was in there, and bumped the SDK version since the old one had that timeout bug.",
  "questions": {
    "pr_scope": {
      "type": "score",
      "instructions": {
        "question": "How focused is this pull request description on a single change?",
        "note": "Judge the number of independent changes, not the size of any one change."
      },
      "criteria": [
        {
          "summary": "One change, clearly stated",
          "signals": [
            "A single fix or feature",
            "Nothing described as \"also\" or \"while I was in there\""
          ]
        },
        {
          "summary": "One main change plus a small related tweak",
          "signals": [
            "A primary change and one minor adjacent edit",
            "The tweak supports the main change"
          ]
        },
        {
          "summary": "Several independent changes bundled together",
          "signals": [
            "Two or more unrelated fixes or features",
            "Changes that could each be their own PR"
          ]
        }
      ]
    }
  }
}

구조화된 Noul criteria

Noul criteria는 선택 사항이며, yes/no 경계가 미묘할 때 구조화된 true와 false 설명을 사용하면 각 쪽에 정의와 예시를 붙여 경계를 정확히 고정할 수 있습니다.

request
{
  "state": {
    "sender": {
      "display_name": "Beaver Dam Builders Ltd.",
      "email": "donotreply@payroll.example"
    },
    "message": "Your Q3 bonus is ready. Reply with your login password so we can verify your identity and release the funds."
  },
  "questions": {
    "requests_credentials": {
      "type": "noul",
      "instructions": {
        "question": "Does the `message` ask the recipient to disclose a sensitive credential?",
        "inspect": "message",
        "focus": "Look for a request to send the credential itself, not a request to change or reset it."
      },
      "criteria": {
        "true": {
          "what": "Asks the recipient to reply with, type, or send a password, PIN, one-time code, or other security sensitive answer",
          "examples": [
            "Reply with your password",
            "Send us the 6-digit code you just received"
          ]
        },
        "false": {
          "what": "No sensitive credential is requested",
          "examples": [
            "Reset your password from the settings page",
            "Your statement is ready"
          ]
        }
      }
    }
  }
}