TDTech Digest

041. 블루프린트 만들기 (Creating blueprints)

  • 원문: English
  • 위치: Amazon Textract Insights › Custom extraction with blueprints › Creating blueprints

한 줄 요약

커스텀 블루프린트는 class, description, properties로 된 JSON 스키마이고, 필드마다 type, inferenceType(explicit/inferred), description을 지정합니다. 표는 반드시 $defs + $ref 패턴으로 정의해야 하며, 인라인 object는 거부됩니다.

🇰🇷 한국어 지원

  • ❌ 미지원. Insights는 6개 언어(영어, 프랑스어, 독일어, 이탈리아어, 포르투갈어, 스페인어)만 처리합니다. 근거: 003

쉽게 말하면

필드 이름은 결과 JSON의 키가 되고, 필드 설명(description)은 모델에게 주는 지시문입니다. 설명을 구체적으로 쓰는 것이 품질의 핵심입니다.

핵심 내용

스키마 구조

수준키설명
루트class문서 유형 라벨(예: Invoice)
루트description문서 한 줄 설명
루트properties추출할 필드 맵
필드typestring, number, boolean, array
필드inferenceTypeexplicit(문서에 적힌 값) / inferred(추론·계산 값)
필드description모델이 값을 찾는 자연어 안내
  • property 키 = 출력 inference_result의 필드 이름 → 다운스트림 코드가 기대하는 이름으로
  • ⚠️ 필드 설명은 모델에 대한 지시로 작동합니다. 신뢰할 수 있는 사람만 스키마·설명을 작성·수정하도록 제한하세요.

explicit vs inferred

값쓰는 경우
explicit문서에 적혀 있는 값(송장 번호, 금액). 형식만 바꾸는 날짜도 explicit(예: “The value under the Invoice date label, in YYYY-MM-DD format”)
inferred문서에 없고 추론·계산해야 하는 값(문맥으로 추정한 통화 코드, 계산된 플래그)

좋은 설명

  • 박스/줄 번호, 기대 형식, 흔한 동의어 포함. 예: “tax withheld"보다 “Social security tax withheld (box 4)”

표(반복 행)

{
  "class": "Invoice",
  "$defs": {
    "LineItem": { "properties": {
      "Description": { "type": "string", "inferenceType": "explicit", "description": "Description of the item or service" },
      "Amount": { "type": "number", "inferenceType": "explicit", "description": "Line total for this item" } } }
  },
  "properties": {
    "InvoiceNumber": { "type": "string", "inferenceType": "explicit", "description": "Unique invoice identifier" },
    "LineItems": { "type": "array", "items": { "$ref": "#/$defs/LineItem" } }
  }
}
  • 출력에서 LineItems는 감지된 행마다 객체 하나인 배열
  • ⚠️ items 안에 { "type": "object", "properties": {...} } 를 직접 쓰면 ValidationException: Blueprint has invalid schema. 표와 중첩 그룹은 항상 $defs + $ref
  • --schema 문자열 최대 크기는 074

관리 명령

작업명령비고
생성create-blueprint --blueprint-name ... --schema file://...ARN 반환. --tags는 블루프린트 전체에 적용(버전별 아님)
수정update-blueprint현재 스키마를 새 스키마로 교체
조회get-blueprint버전 미지정 시 현재 스키마
목록list-blueprints --resource-owner ACCOUNT내 계정 블루프린트
삭제delete-blueprint⚠️ 번호 버전이 남아 있거나 프로젝트가 참조 중이면 불가 (042)

📝 원문 확인 필요: 이 페이지는 “$defs 항목은 properties만 있고 type이 없다"고 하지만, 043의 검증 스키마는 $defs 항목에 type을 허용하고, 047 예시는 "type": "object"를 씁니다. 또 “모든 필드에 type/inferenceType/description“이라고 하지만 표 필드(LineItems)에는 inferenceType을 넣지 않는 것이 규칙입니다.

SA 관점

  • 블루프린트 스키마를 Git으로 관리하고, 변경은 리뷰를 거쳐 update-blueprint + 버전 생성으로 배포하는 흐름을 권장합니다(설명 = 프롬프트이므로 프롬프트 인젝션 관점의 통제 필요).