Skip to Content
API 레퍼런스Decisions 판단

Decisions API

Decisions API는 모델이 텍스트를 생성하는 대신 콘텐츠에 대해 유형화된 판단을 내리도록 합니다. 판단할 콘텐츠와 질문 목록을 제공하면, 모델은 각 질문에 대해 구조화된 답변을 반환합니다. 예/아니요의 확률, 선택지 중 하나의 선택, 또는 등급 척도상의 점수이며, 각 선택지의 확률과 신뢰도가 함께 제공됩니다.

분류, 라우팅, 검수, 점수 매기기, 필터링 등 프로그램이 결과를 받아 바로 분기 처리해야 하는 경우에 적합합니다. 모델은 지정한 선택지와 등급 안에서만 답하며, 그 밖의 내용은 반환하지 않으므로 자유 형식 텍스트를 파싱할 필요가 없습니다.

판단 모델을 처음 사용하는 경우 먼저 Jev 사용 가이드를 읽어 보시기를 권장합니다. 빠른 시작, 질문 설계, 반환 결과 설명, 시나리오 예시를 다룹니다. 이 페이지는 필드 단위 레퍼런스입니다.

엔드포인트

세 경로 모두 동일한 모델과 동일한 과금 체계를 사용하며, 요청과 응답의 형식만 다릅니다. 사용하는 클라이언트에 맞는 경로를 선택하십시오.

경로형식적합한 경우
POST https://api.ofox.ai/v1/decisionsOfoxAI 통합 형식(질문은 배열)cURL, 임의의 HTTP 클라이언트, OpenAI SDK
POST https://api.ofox.ai/openai/v1/decisions위와 동일OpenAI SDK의 base_url을 https://api.ofox.ai/openai/v1로 설정한 프로젝트
POST https://api.ofox.ai/typesafe/v1/systemoneTypeSafe 공식 System One 형식(질문은 객체)TypeSafe 공식 SDK, 또는 TypeSafe 공식 문서를 따라 작성한 코드

인증 방식은 다른 API와 동일합니다: Authorization: Bearer <OFOXAI_API_KEY>. 스트리밍은 지원하지 않으며, 한 번의 요청으로 모든 답변이 동기적으로 반환됩니다.

사용 가능한 모델

모델 ID설명
typesafe/jev-latestTypeSafe Jev, 판단 전용 모델. 텍스트 또는 JSON 입력만 지원하며 컨텍스트는 64K입니다. jev-latest로 줄여 쓸 수 있습니다
openai/gpt-6-luna세 경로 모두에서 지원되며, 이미지를 읽을 수 있습니다(메시지 배열에 input_image 전달)

이 API를 지원하는 전체 모델 목록은 모델 페이지 를 참고하십시오. 일반 대화 모델(예: openai/gpt-4o)로 호출하면 endpoint_not_supported가 반환됩니다.

통합 형식: /v1/decisions

요청 파라미터

파라미터타입필수설명
modelstring✅모델 ID. 예: typesafe/jev-latest
inputstring | object | array✅판단할 콘텐츠. 입력 형식 참고
questionsarray✅질문 목록. 각 요소는 질문 객체입니다. 답변은 같은 순서로 반환됩니다
safety_identifierstring—고정된 최종 사용자 ID. OpenAI 모델에서만 적용됩니다

입력 형식

input은 세 가지 형태를 지원합니다.

  • 텍스트: 문자열 하나.
    "input": "Customer message: I was charged twice, nobody has answered my two emails, and I need a refund today."
  • 구조화된 데이터: JSON 객체 하나로, 그대로 모델에 전달됩니다. 질문에서 백틱으로 필드 이름을 참조할 수 있습니다. 예: `message`.
    "input": { "ticket_id": 4812, "message": "I was charged twice.", "plan": "pro" }
  • 메시지 배열: [{ "role", "content" }]. content는 문자열 또는 콘텐츠 블록 목록이며, 콘텐츠 블록은 input_text와 input_image만 지원합니다. 이미지는 이미지를 읽을 수 있는 모델에서만 유효합니다. Jev는 이미지를 읽지 않으며, 이미지를 전달하면 400이 반환됩니다.

질문 객체

필드적용 유형설명
type전체predicate(예/아니요), choice(단일 선택), score(등급 점수)
name전체선택 사항이지만 지정을 권장합니다. 답변에 그대로 포함되어 대응 관계를 확인하기 쉽습니다. 같은 요청 안에서 중복될 수 없습니다
instructions전체질문 자체. 문자열, 또는 질문과 참고 데이터를 포함한 JSON 객체
criteriapredicate선택 사항. { "true": "...", "false": "..." } 형식으로 「예」와 「아니요」가 각각 무엇을 뜻하는지 설명합니다
choiceschoice필수. 선택지 배열이며 각 항목은 { "value": "billing", "description": "Charges, refunds" } 형식입니다. description은 생략할 수 있습니다. 최대 255개
levelsscore필수. 낮은 등급에서 높은 등급 순으로 나열한 배열이며 각 항목은 { "label": "low", "description": "..." } 형식입니다. 2–10단계

요청 예시

Terminal
curl https://api.ofox.ai/v1/decisions \ -H "Authorization: Bearer $OFOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "typesafe/jev-latest", "input": "Customer message: I was charged twice, nobody has answered my two emails, and I need a refund today.", "questions": [ { "type": "predicate", "name": "is_frustrated", "instructions": "Is the customer frustrated?" }, { "type": "choice", "name": "category", "instructions": "Which category does this ticket belong to?", "choices": [ { "value": "billing", "description": "Charges and refunds" }, { "value": "bug", "description": "Product issue" }, { "value": "other", "description": "Other" } ] }, { "type": "score", "name": "urgency", "instructions": "How quickly does a human need to respond?", "levels": [ { "label": "low", "description": "Within a week is fine" }, { "label": "medium", "description": "Should respond soon" }, { "label": "high", "description": "Must respond today" } ] } ] }'

응답 형식

{ "model": "typesafe/jev-latest", "answers": [ { "type": "predicate", "name": "is_frustrated", "probability": 0.97 }, { "type": "choice", "name": "category", "choice": "billing", "confidence": 1, "probabilities": [ { "value": "billing", "probability": 1 }, { "value": "bug", "probability": 0 }, { "value": "other", "probability": 0 } ] }, { "type": "score", "name": "urgency", "score": 2, "confidence": 1, "legend": { "0": "low: Within a week is fine", "1": "medium: Should respond soon", "2": "high: Must respond today" }, "probabilities": [ { "value": 0, "label": "low", "probability": 0 }, { "value": 1, "label": "medium", "probability": 0 }, { "value": 2, "label": "high", "probability": 1 } ] } ], "usage": { "prompt_tokens": 407, "completion_tokens": 72, "total_tokens": 479 } }

answers는 questions와 일대일로 대응하며 순서도 같습니다. 유형별 답변 필드는 다음과 같습니다.

유형필드설명
predicateprobability답이 「예」일 확률, 0–1
choicechoice확률이 가장 높은 선택지
probabilities각 선택지의 확률이며 합계는 1
confidence이번 판단에 대한 모델의 확신 정도, 0–1. 확률과 신뢰도 참고
scorescore확률로 가중한 등급 값으로 0부터 시작하며, 두 등급 사이의 값이 될 수 있습니다(예: 1.43)
legend등급 번호와 설명의 대응표
probabilities각 등급의 확률
confidence위와 동일

TypeSafe 네이티브 형식: /typesafe/v1/systemone

TypeSafe 공식 API 와 요청·응답 형식이 같으므로 TypeSafe SDK를 그대로 사용하거나 기존 코드를 이전할 때 적합합니다. 통합 형식과의 차이는 다음과 같습니다.

통합 형식 /v1/decisionsTypeSafe 네이티브 형식
판단할 콘텐츠inputstate
질문배열, name으로 식별객체, 키 이름이 곧 질문 ID
예/아니요 질문type: "predicate", 답변 필드 probabilitytype: "noul", 답변 필드 noul
선택지와 등급choices / levels 배열모두 criteria에 작성: choice는 {선택지: 설명} 객체, score는 설명 문자열 배열
사용량 필드prompt_tokens / completion_tokensinput_tokens / output_tokens
Terminal
curl https://api.ofox.ai/typesafe/v1/systemone \ -H "Authorization: Bearer $OFOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "jev-latest", "state": "Help! My payouts have been failing for 3 days.", "questions": { "is_urgent": { "type": "noul", "instructions": "Does this convey urgency?" }, "department": { "type": "choice", "instructions": "Which team should handle this?", "criteria": { "billing": "Payments, invoicing, refunds", "technical": "Bugs, outages, integrations", "sales": "Pricing, upgrades" } }, "frustration": { "type": "score", "instructions": "How frustrated is the customer?", "criteria": ["Calm", "Frustrated", "Very angry"] } } }'
{ "model": "typesafe/jev-latest", "answers": { "is_urgent": { "type": "noul", "noul": 0.95 }, "department": { "type": "choice", "choice": "billing", "confidence": 0.85, "probabilities": { "billing": 0.9, "technical": 0.1, "sales": 0 } }, "frustration": { "type": "score", "score": 1.03, "confidence": 0.95, "legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" }, "probabilities": { "0": 0, "1": 0.97, "2": 0.03 } } }, "usage": { "input_tokens": 399, "output_tokens": 73 } }

SDK 연동

OpenAI SDK

OpenAI 공식 SDK는 client.decisions.create()를 제공합니다. base_url을 https://api.ofox.ai/v1로 지정하고 요청 본문은 통합 형식을 사용하면 됩니다. 예시는 위의 Python 탭을 참고하십시오. Decisions API가 포함된 SDK 버전이 필요합니다(openai Python 3.31.0에서 동작 확인).

TypeSafe SDK

TypeSafe 공식 SDK에서는 base_url을 https://api.ofox.ai/typesafe로 지정하고 api_key를 OfoxAI API Key로 바꾸면 되며, 나머지 코드는 그대로 둡니다.

typesafe_sdk.py
# pip install typesafe-sdk import os from typesafe_sdk import TypeSafeClient, Noul, Choice, Score with TypeSafeClient(base_url="https://api.ofox.ai/typesafe", api_key=os.environ["OFOX_API_KEY"]) as client: r = client.system_one( model="jev-latest", state={"message": "I was charged twice, nobody has answered my two emails, and I need a refund today."}, questions={ "urgent": Noul(instructions="Is the customer asking for this to be handled today?"), "dept": Choice( instructions="Which team should handle this?", criteria={"billing": "Charges, invoices, refunds", "technical": "Bugs, integrations", "sales": "Pricing, upgrades"}, ), "anger": Score(instructions="How upset is the customer?", criteria=["Calm", "Upset but polite", "Very angry"]), }, ) print(r.nouls["urgent"].noul) # 0.98 print(r.choices["dept"].choice) # billing print(r.scores["anger"].score) # 1.56

확률과 신뢰도

  • 확률은 「답이 무엇인가」에 답합니다. probability, probabilities는 각 답변에 대한 모델의 보정된 확률입니다.
  • 신뢰도는 「이번 판단을 믿어도 되는가」에 답합니다. confidence는 확률 분포에서 도출되며, 분포가 한쪽에 집중될수록 높아집니다. 두 선택지가 각각 0.5일 때도 choice는 하나를 반환하지만 confidence는 매우 낮습니다.

일반적으로는 코드에 임곗값을 두고, 신뢰도가 높으면 자동으로 처리하고 낮으면 사람에게 넘기거나 더 강력한 모델로 재검토합니다.

과금

토큰 단위로 과금되며, 단가는 모델 페이지 를 참고하십시오. typesafe/jev-latest는 입력 토큰에만 과금되며 출력은 과금되지 않습니다(completion_tokens / output_tokens는 그대로 반환됩니다).

한 요청 안의 모든 질문은 동일한 입력을 공유하므로, 여러 질문을 하나의 요청에 담는 것이 여러 번 나누어 호출하는 것보다 훨씬 저렴하고 빠릅니다.

제한

항목제한
요청 본문최대 32 MiB
컨텍스트Jev는 64K 토큰이며, 초과 시 400 반환
choice 선택지최대 255개
score 등급2–10단계
JSON 중첩input/state, instructions, criteria 각각 최대 64단계
스트리밍지원하지 않음

자주 발생하는 오류

HTTP · type오류 원문원인해결 방법
400 invalid_request_errorquestion "a" has kind choice and requires criteria optionschoice 질문에 choices가 없음선택지 배열 추가
400 invalid_request_errorquestion name "a" is used more than once두 질문의 name이 같음중복되지 않는 이름으로 변경
400 invalid_request_errorToo many score levels. Must have at most 10 levels.score 등급이 10개를 초과함등급을 합치거나 여러 질문으로 분리
400 invalid_request_errordecision input carries an "input_image" part, which Typesafe cannot readJev에 이미지를 전달함이미지를 제거하거나 이미지를 읽을 수 있는 모델로 변경
400 invalid_request_errorInvalid request payload/v1/decisions에 TypeSafe 네이티브 형식(state + 객체 형식의 questions)을 사용함통합 형식으로 바꾸거나 /typesafe/v1/systemone을 호출
400 endpoint_not_supportedModel 'openai/gpt-4o' does not support the /v1/decisions endpoint on this platform.해당 모델이 판단 모델이 아님사용 가능한 모델로 변경
404 model_not_foundModel 'typesafe/jev-9' not found모델 ID 오류typesafe/jev-latest 사용
404 invalid_request_errorUnsupported API endpoint.경로를 /v1/systemone으로 작성함TypeSafe 네이티브 형식의 경로는 /typesafe/v1/systemone

기타 공통 오류는 오류 처리를 참고하십시오.

마지막 업데이트