Skip to main content

템플릿 레이아웃 생성

Gemini(temperature 0.2)를 사용하여 자연어 prompt로부터 구조화된 ReportSection 정의를 생성, 추가 또는 편집합니다. 모델이 섹션의 dataPath 바인딩과 열 레이아웃을 실제 페이로드 구조에 맞출 수 있도록 previewData에 샘플 검증 데이터를 전달하세요.

헤드리스 리포트 빌더 및 AI 에이전트 파이프라인에서는 섹션 JSON을 수동으로 작성하지 않고도 전체 레이아웃을 스캐폴딩하거나("create"), 기존 템플릿에 후속 섹션을 추가하거나("append"), 단일 섹션을 다듬을 때("edit") 이 엔드포인트를 사용하세요. 리포트 템플릿 생성 또는 리포트 템플릿 수정으로 저장하기 전에 템플릿 HTML 미리보기와 함께 호출하여 렌더링된 출력을 확인할 수 있습니다.

엔드포인트​

POST https://api.verifik.co/v2/smart-report-templates/generate-layout

Smart-Agent 프록시(https://ai.verifik.co)도 동일한 /v2/... 경로를 제공하며 본인의 Authorization: Bearer <VERIFIK_JWT> 헤더가 필요합니다.

헤더​

이름값
Content-Typeapplication/json
Acceptapplication/json
AuthorizationBearer <VERIFIK_JWT>

요청 본문​

이름타입필수설명
promptstring예생성할 레이아웃, 추가할 섹션 또는 edit 모드에서 적용할 변경 사항을 설명하는 자연어 지침.
modestring예생성 모드: "create", "edit" 또는 "append".
previewDataobject아니요생성된 dataPath 표현식과 열을 실제 데이터에 맞추기 위한 샘플 검증 JSON(예: inputData, results, batchName).
currentSectionsobject[]아니요기존 ReportSection 배열. 새로 생성된 섹션이 기존 order 시퀀스를 이어갈 수 있도록 "append" 모드에서 권장됩니다.
selectedSectionobject / null아니요mode가 "edit"일 때 수정할 대상 ReportSection 객체. "edit" 모드에서 null이거나 생략되면 "create" 모드로 폴백합니다.

요청​

const fetch = require("node-fetch");

async function run() {
const res = await fetch(
"https://api.verifik.co/v2/smart-report-templates/generate-layout",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
body: JSON.stringify({
prompt:
"Create a clean 2-column driver summary section followed by a table of traffic citations.",
mode: "create",
previewData: {
batchName: "Driver Onboarding",
rowIndex: 0,
inputData: {
documentType: "CC",
documentNumber: "1020304050",
},
results: {
identity: { fullName: "Mateo Rojas", status: "active" },
fines: [{ code: "C02", amount: 580000, status: "pending" }],
},
},
}),
}
);

console.log(await res.json());
}

run();

응답​

{
"data": [
{
"id": "sec-driver-summary",
"type": "keyValueGrid",
"order": 0,
"label": "Driver Summary",
"dataPath": "results.identity",
"columnsPerRow": 2
},
{
"id": "sec-traffic-fines",
"type": "dataTable",
"order": 1,
"label": "Traffic Citations",
"dataPath": "results.fines",
"columns": [
{ "key": "code", "label": "Code" },
{ "key": "amount", "label": "Amount" },
{ "key": "status", "label": "Status" }
]
}
]
}

참고 사항​

  • "create" 및 "append" 모드는 { "data": [ ...ReportSection ] }(배열)을 반환하는 반면, null이 아닌 selectedSection이 있는 "edit" 모드는 { "data": { ...ReportSection } }(단일 객체)를 반환합니다.
  • selectedSection: null로 "edit"를 호출하거나 selectedSection을 생략하면 "create" 모드로 폴백하여 배열을 반환합니다.
  • 이 엔드포인트는 데이터베이스에 쓰지 않습니다. 반환된 sections를 템플릿 HTML 미리보기에 전달하여 HTML을 확인하거나 리포트 템플릿 생성에 전달하여 저장하세요.

관련 문서​