이제 모델이 schema 따르도록 강제 가능
2023엔 모델한테 정중히 JSON return 해달라 부탁하고 기도했어. 2026엔 모든 주요 provider가 structured-output 모드 지원 — 모델이 decoding 수준에서 constraint, sample되는 모든 토큰이 schema 체크되고, invalid JSON 만들 토큰은 emit 안 돼. Output 구조가 더 이상 prompt instruction이 아니라 server-side 보장이야.
provider별 feature
- OpenAI —
response_format = {"type": "json_schema", "json_schema": {...}}. Strict 모드가 schema 정확히 enforce. - Anthropic — tool calling으로 JSON 모드 (단일 tool의 input_schema가 desired output, 사용 force). 신규 SDK에 native structured-output endpoint 있음.
- Gemini —
response_mime_type = "application/json"과response_schema.
프롬프트가 여전히 하는 일
structured output enforce돼도 프롬프트가 heavy lifting: 각 field의 의미, field 사이 관계, null/empty 값 policy를 설명. Schema는 shape, 프롬프트는 semantics. structured output을 instruction 대체로 다루지 마.