C.W.K.
Stream
Lesson 03 of 10 · published

OpenAI — JSON 모드, function calling, reasoning

~14 min · providers, openai

Level 0수련생
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

OpenAI가 잘하는 것

  • Strict JSON Schema 모드 (response_format with json_schema, strict: true).
  • Parallel call 박힌 mature한 function calling.
  • effort level 박힌 o-series와 GPT-5.5 reasoning.
  • Text, vision, audio multimodal.
  • Low-latency voice용 Realtime API.

알 quirk

  • 3개 role: system, developer, user. Developer는 user보다 outrank돼야 하는데 user한테 invisible해야 하는 app-level instruction용.
  • Reasoning 토큰 billed인데 developer한테 return X (답 봐, trace X).
  • Strict JSON Schema 모드가 JSON Schema의 subset 지원 — 모든 keyword 받아들여지지 X.
  • Function-call style: argument가 너가 parse하는 JSON string으로 return, parsed object X.

Style preference

OpenAI 모델이 terse, imperative한 system prompt와 well-described function definition에 잘 응답. Heavy XML-tag scaffolding이 interfere; Claude보다 더 light하게.

Code

OpenAI — strict structured output + reasoning·python
import openai

client = openai.OpenAI()
resp = client.chat.completions.create(
    model="gpt-5.5",
    messages=[{"role": "system", "content": "You are a contract analyst."},
              {"role": "user", "content": question}],
    response_format={
        "type": "json_schema",
        "json_schema": {"name": "findings", "strict": True, "schema": SCHEMA}
    },
    reasoning={"effort": "high"},
    max_completion_tokens=2048,
)

External links

Exercise

한 prompt를 non-strict 'please return JSON' style에서 OpenAI strict JSON Schema 모드로 migrate. schema enforce되면 가능한 prompt simplification 메모.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.