查看處理器版本的詳細資料
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
取得處理器版本的詳細資料
深入探索
如需包含這個程式碼範例的詳細說明文件,請參閱下列內容:
程式碼範例
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis code sample retrieves details about a specific processor version using the Document AI API.\u003c/p\u003e\n"],["\u003cp\u003eThe script utilizes the \u003ccode\u003eget_processor_version\u003c/code\u003e method from the \u003ccode\u003eDocumentProcessorServiceClient\u003c/code\u003e to fetch information.\u003c/p\u003e\n"],["\u003cp\u003eTo run the script, you need to provide the project ID, processor location, processor ID, and the processor version ID.\u003c/p\u003e\n"],["\u003cp\u003eThe output includes the processor version's display name and its deployment state.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication must be set up for the Document AI with the Application Default Credentials.\u003c/p\u003e\n"]]],[],null,["# View details about a processor version\n\nGets details about a processor version for a processor\n\nExplore further\n---------------\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Managing processor versions](/document-ai/docs/manage-processor-versions)\n\nCode sample\n-----------\n\n### Python\n\n\nFor more information, see the\n[Document AI Python API\nreference documentation](/python/docs/reference/documentai/latest).\n\n\nTo authenticate to Document AI, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n from google.api_core.client_options import ClientOptions\n from google.cloud import documentai # type: ignore\n\n # TODO(developer): Uncomment these variables before running the sample.\n # project_id = 'YOUR_PROJECT_ID'\n # location = 'YOUR_PROCESSOR_LOCATION' # Format is 'us' or 'eu'\n # processor_id = 'YOUR_PROCESSOR_ID' # Create processor before running sample\n # processor_version_id = 'YOUR_PROCESSOR_VERSION_ID'\n\n\n def get_processor_version_sample(\n project_id: str, location: str, processor_id: str, processor_version_id: str\n ) -\u003e None:\n # You must set the api_endpoint if you use a location other than 'us'.\n opts = ClientOptions(api_endpoint=f\"{location}-documentai.googleapis.com\")\n\n client = documentai.https://cloud.google.com/python/docs/reference/documentai/latest/google.cloud.documentai_v1.services.document_processor_service.DocumentProcessorServiceClient.html(client_options=opts)\n\n # The full resource name of the processor version\n # e.g.: projects/project_id/locations/location/processors/processor_id/processorVersions/processor_version_id\n name = client.https://cloud.google.com/python/docs/reference/documentai/latest/google.cloud.documentai_v1.services.document_processor_service.DocumentProcessorServiceClient.html#google_cloud_documentai_v1_services_document_processor_service_DocumentProcessorServiceClient_processor_version_path(\n project_id, location, processor_id, processor_version_id\n )\n\n # Make GetProcessorVersion request\n processor_version = client.https://cloud.google.com/python/docs/reference/documentai/latest/google.cloud.documentai_v1.services.document_processor_service.DocumentProcessorServiceClient.html#google_cloud_documentai_v1_services_document_processor_service_DocumentProcessorServiceClient_get_processor_version(name=name)\n\n # Print the processor version information\n print(f\"Processor Version: {processor_version_id}\")\n print(f\"Display Name: {processor_version.display_name}\")\n print(f\"DEPLOYED: {processor_version.state}\")\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=documentai)."]]