Classify API의 문서 분할 기능은 서로 다른 유형의 여러 문서가 단일 파일에 결합된 경우(예: 신청서, 신분증, 은행 거래 명세서가 포함된 단일 PDF 파일)를 위해 설계되었어요.
같은 유형의 여러 문서가 포함된 파일을 가지고 있다면, 더 효율적인 처리를 위해 Information Extract를 사용해 문서를 분할할 수 있어요.
이 기능을 활성화하려면, 요청에서 split 파라미터를 true로 설정하기만 하면 돼요.
분할된 각 문서 그룹은 choices 리스트에 별도의 항목으로 반환돼요.
분할된 문서들이 원본 문서에서 연속되어 있지 않지만 동일한 문서 클래스와 분할 기준 결과를 공유하는 경우, 모델은 이들을 단일 문서로 취급해요.
이에 따라 페이지 범위는 [start, end] 쌍의 리스트로 표현된 여러 비연속 범위를 포함할 수 있어요(예: [[1, 3], [6, 6]]).
요청
response = client.chat.completions.create( model="document-classify", messages=[ { "role": "user", "content": [ { "type": "image_url", "image_url": {"url": f"data:application/octet-stream;base64,{base64_data}"} } ] } ], response_format={ "type": "json_schema", "json_schema": { "name": "document-classify", "schema": { "type": "string", "oneOf": [ {"const": "invoice", "description": "Commercial invoice with itemized charges and billing information"}, {"const": "receipt", "description": "Receipt showing purchase transaction details"}, {"const": "contract", "description": "Legal agreement or contract document"}, {"const": "cv", "description": "Curriculum vitae or resume"}, {"const": "others", "description": "Other"} ] } } }, extra_body={ "split": True, "split_criteria": [ {"criterion": "document_id", "description": "The id that indicates each unit document."} ] } )print(response)