데모 input에서 work하는 프롬프트
instruction 쓰기에서 가장 어려운 부분은 프롬프트를 work하게 만드는 게 아니라 — input이 비었거나, user가 hostile이거나, 문서가 다른 언어이거나, schema field가 missing일 때도 계속 work하게 만드는 거야. Edge case는 exotic한 게 아니야 — 진짜 traffic의 long tail이야.
이름 붙여야 하는 edge category
- 빈 input — "" 또는 null user message.
- 잘못된 type input — text 기대하는데 숫자, text 기대하는데 image.
- hostile input — 모델이 요약해야 하는 데이터 안에 instruction 숨김.
- 다국어 input — 영어 전용 프롬프트에 한국어 메시지.
- 범위 밖 input — 코드 생성 프롬프트한테 환불 질문.
- missing context — 필요한 문서가 retrieve 안 됨.
- truncated context — 50개 문서 중 5개만 들어감.
constraint 패턴
각 edge마다 상황에 이름 붙이고 행동 prescribe하는 한 문장을 프롬프트에 써. "If the input is empty, return {error: 'empty_input'}. If the input is in a language other than English, translate before answering and tag the translation. If a required document is missing, return {status: 'insufficient_context', missing: [...]}."
그래, 프롬프트가 길어져. 그리고 월요일 아침에도 살아남게 돼.