input_file 이 PDF 를 직접 받아 — chunking, OCR pipeline 따로 X. response_format 의 Pydantic model 과 결합하면 30 줄짜리 invoice/report 추출기 완성.
한 pipeline 이 셋을 대체
Pre-input_file 패턴 — pdfplumber → text extraction → chunking → embedding → vector search → prompt 조립 → JSON parsing. input_file + response_format 으로 한 API call 에 collapse.
Long document caveat
input_file 은 PDF 전체를 한 번에 처리 → 매우 긴 문서 (100+ 페이지) 는 context window limit 에 hit. 그 case 엔 chunking 필요. Invoice, report, contract, single-page form 엔 input_file 이 canonical.
Pydantic 으로 contract
class Invoice(BaseModel): vendor: str; invoice_number: str; total: float; currency: str; line_items: list[LineItem]. response_format=Invoice 로 호출 → 모델이 정확히 그 shape 반환. Defensive 파싱 0.