# pip install requestsimport requestsresponse = requests.post( "https://api.upstage.ai/v1/systemone", headers={"Authorization": "Bearer UPSTAGE_API_KEY"}, json={ "model": "solar-decide", "state": ( "Customer ticket #4821: My package never arrived and I want my money back. " "I have been waiting three weeks and nobody has replied to my emails." ), "questions": { "intent": { "type": "choice", "instructions": "Classify what the customer is asking for.", "criteria": { "refund": "The customer wants money back.", "track": "The customer wants the delivery status of an order.", "other": "Anything else.", }, }, "urgency": { "type": "score", "instructions": "Rate how urgently this ticket needs a reply.", "criteria": [ "No action needed", "Can wait a week", "Needs attention today", "Escalate immediately", ], }, "is_angry": { "type": "noul", "instructions": "Is the customer angry?", }, }, },)answers = response.json()["answers"]print(answers["intent"]["choice"], answers["intent"]["confidence"])print(answers["urgency"]["score"])print(answers["is_angry"]["noul"])
choice 질문은 선택지 2~26개를 받습니다. 이 엔드포인트는 단일 토큰 레이블 A부터 Z까지의 로짓을 바탕으로 판단하므로, 한 번에 점수를 매길 수 있는 선택지는 최대 26개입니다. 그보다 많은 선택지 중에서 고르려면 판단을 여러 질문으로 나누거나 호출 전에 후보를 좁히세요.
26개를 넘는 선택지를 보내면 422가 반환됩니다.
{ "error": { "type": "validation_failed", "message": "question q: 27 candidates exceed the 26 single-token labels this route supports" }}