Document AI는 ProcessDocument, BatchProcessDocuments 요청에 프로세서로 전송되는 메타데이터로 사용자 정의 라벨 또는 키-값 쌍 (KVP)을 추가하는 것을 지원합니다.
요청에 관한 이 메타데이터는 사용량 데이터 (예: 페이지 수)와 함께 Cloud Billing 시스템으로 전달됩니다. 이 필드는 결제 시스템에 채워지며, 여기에서 이러한 메타데이터 라벨을 사용하여 필터링하여 청구 상세 내역을 확인할 수 있습니다.
사용 사례
라벨의 중요한 사용 사례에는 다수의 클라이언트에 문서 처리 서비스를 제공하는 고객이 포함됩니다. 하나의 프로젝트를 여러 클라이언트에 사용할 수 있습니다.
결제 용도로 특정 요청을 해당 클라이언트와 연결해야 합니다. 이때 메타데이터 라벨이 사용됩니다. Google Cloud에서 보고서를 필터링하는 데 사용됩니다.
라벨 요구사항
요청에 적용된 라벨은 다음 요구사항을 충족해야 합니다.
각 요청에는 라벨이 최대 64개까지 있을 수 있습니다.
각 라벨은 KVP여야 합니다.
키는 비워 둘 수 없으며 최소 길이는 1자이고 최대 길이는 63자입니다. 값은 비워 둘 수 있으며 최대 길이는 63자(영문 기준)입니다.
키와 값에는 소문자, 숫자, 밑줄, 대시만 사용합니다. 모든 문자는 UTF-8 인코딩을 사용해야 하며 국제 문자가 허용됩니다.
라벨의 키 부분은 단일 요청 내에서 고유해야 합니다. 예를 들어 {'country':'india'}는 문제가 없지만 {'country':'india','country':'sweden'}은 허용되지 않습니다.
키는 소문자나 국제 문자로 시작해야 합니다.
API와 함께 사용
Sync Process 코드 샘플은 라벨을 사용하여 프로세서에 요청을 보내는 방법을 보여줍니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eDocument AI allows adding custom metadata labels (key-value pairs) to \u003ccode\u003eProcessDocument\u003c/code\u003e and \u003ccode\u003eBatchProcessDocuments\u003c/code\u003e requests.\u003c/p\u003e\n"],["\u003cp\u003eThese metadata labels are forwarded to the Cloud Billing system, enabling users to filter and break down billing charges based on these labels.\u003c/p\u003e\n"],["\u003cp\u003eEach request can have up to 64 labels, and each label consists of a key and a value, both of which have character and length constraints.\u003c/p\u003e\n"],["\u003cp\u003eLabels are particularly useful for customers managing document processing services for multiple clients within a single project, as they facilitate the association of specific requests with their respective clients for billing purposes.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Billing console allows for filtering usage reports using these metadata labels, enabling detailed analysis of request activity.\u003c/p\u003e\n"]]],[],null,["# Custom metadata labels\n======================\n\nDocument AI supports adding user-defined labels or key-value pairs (KVPs) as metadata\nsent to the processor to [`ProcessDocument`](/document-ai/docs/reference/rest/v1/projects.locations.processors/process), [`BatchProcessDocuments`](/document-ai/docs/reference/rest/v1/projects.locations.processors/batchProcess)\nrequests.\nThis metadata about the request (along with the usage data, like number of pages)\nis forwarded to the Cloud Billing system. It's populated in the billing\nsystem, where you can break down your billing charges by filtering using these metadata labels.\n\nUse case\n--------\n\nAn important use case for labels involves customers who provide document processing\nservices to many clients. A single project can be used for multiple clients.\nFor billing purposes, it's important to associate specific requests with their\nrespective clients. That's where these metadata labels come in. They're for filtering\nreports in Google Cloud.\n\nRequirements for labels\n-----------------------\n\nThe labels applied to a request must meet the following requirements:\n\n- Each request can have multiple labels, up to a maximum of 64.\n- Each label must be a KVP.\n- Keys have a minimum length of 1 character and maximum 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.\n- Keys and values contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.\n- The key portion of a label must be unique within a single request (for example, `{'country':'india'}` is fine, but `{'country':'india','country':'sweden'}` is not allowed).\n- Keys must start with a lowercase letter or international character.\n\nUsage with API\n--------------\n\nThe `Sync Process` code sample shows you how to send a request to a processor using a label. \n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @docai_request.json \\\n \"https://us-documentai.googleapis.com/v1/projects/514064100333/locations/us/processors/3bb61571a9731982:process\"\n\nSample Request \n\n {\n \"skipHumanReview\": true,\n \"rawDocument\": {\n \"mimeType\": \"application/pdf\",\n \"content\" : \"PDF/IMAGE CONTENT\"\n },\n \"labels\": {\"country\": \"india\" },\n \"processOptions\": {\n \"individualPageSelector\" : {\n \"pages\": [1]\n }\n }\n }\n\nThe `Async Process` code sample shows you how to send a request to a processor using a label. \n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @batch_docai_request.json \\\n \"https://us-documentai.googleapis.com/v1/projects/514064100333/locations/us/processors/3bb61571a9731982:batchProcess\"\n\nSample Request \n\n {\n \"inputDocuments\": {\n \"gcsPrefix\": {\n \"gcsUriPrefix\": \"gs://atul_dai_test/ravi/GCS_DWH_work_flows_docs/Small_pdf/\"\n }\n },\n \"documentOutputConfig\": {\n \"gcsOutputConfig\": {\n \"gcsUri\": \"gs://atul_dai_test/ravi/GCS_DWH_work_flows_docs/test/docai_config/\"\n }\n },\n \"labels\": {\"country\": \"india\" },\n \"skipHumanReview\": true\n }\n\n### Pricing report\n\nYou can use these labels to view request usage.\n\n1. Go to the [Cloud Billing console](https://console.cloud.google.com/billing).\n\n2. From the console, select the **Menu** at the upper left, and select **Billing** from the drop-down. If you have multiple billing accounts\n a page appears that asks you to make a selection. Select **Go to linked billing account**.\n\n3. From the billing page, select **Reports** in the left-hand navigation pane.\n\n4. Use the filters in the right-hand pane to check usage of requests."]]