Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Document AI mendukung penambahan label atau pasangan nilai kunci (KVP) yang ditentukan pengguna sebagai metadata yang dikirim ke pemroses untuk permintaan ProcessDocument, BatchProcessDocuments.
Metadata tentang permintaan ini (bersama dengan data penggunaan, seperti jumlah halaman) diteruskan ke sistem Penagihan Cloud. Label ini diisi di sistem penagihan, tempat Anda dapat mengelompokkan biaya penagihan dengan memfilter menggunakan label metadata ini.
Kasus penggunaan
Kasus penggunaan penting untuk label melibatkan pelanggan yang menyediakan layanan pemrosesan dokumen kepada banyak klien. Satu project dapat digunakan untuk beberapa klien.
Untuk tujuan penagihan, penting untuk mengaitkan permintaan tertentu dengan kliennya masing-masing. Di sinilah fungsi label metadata ini. Filter ini digunakan untuk memfilter laporan di Google Cloud.
Persyaratan untuk label
Label yang diterapkan ke permintaan harus memenuhi persyaratan berikut:
Setiap permintaan dapat memiliki beberapa label, hingga maksimum 64 label.
Setiap label harus berupa KVP.
Kunci memiliki panjang minimum 1 karakter dan maksimum 63 karakter serta tidak boleh kosong. Nilai boleh kosong dan memiliki panjang maksimum 63 karakter.
Kunci dan nilai hanya berisi huruf kecil, karakter numerik, garis bawah, dan tanda hubung. Semua karakter harus menggunakan encoding UTF-8, dan karakter internasional boleh digunakan.
Bagian kunci label harus unik dalam satu permintaan (misalnya, {'country':'india'} boleh saja, tetapi {'country':'india','country':'sweden'} tidak diizinkan).
Kunci harus diawali dengan huruf kecil atau karakter internasional.
Penggunaan dengan API
Contoh kode Sync Process menunjukkan cara mengirim permintaan ke pemroses menggunakan label.
Dari konsol, pilih Menu di kiri atas, lalu pilih Penagihan dari drop-down. Jika Anda memiliki beberapa akun penagihan, akan muncul halaman yang meminta Anda untuk memilih. Pilih Buka akun penagihan tertaut.
Dari halaman penagihan, pilih Laporan di panel navigasi sebelah kiri.
Gunakan filter di panel sebelah kanan untuk memeriksa penggunaan permintaan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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."]]