document_processor_service.proto 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.documentai.v1beta3;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/documentai/v1beta3/document.proto";
  21. import "google/cloud/documentai/v1beta3/document_io.proto";
  22. import "google/cloud/documentai/v1beta3/document_schema.proto";
  23. import "google/cloud/documentai/v1beta3/evaluation.proto";
  24. import "google/cloud/documentai/v1beta3/operation_metadata.proto";
  25. import "google/cloud/documentai/v1beta3/processor.proto";
  26. import "google/cloud/documentai/v1beta3/processor_type.proto";
  27. import "google/longrunning/operations.proto";
  28. import "google/protobuf/field_mask.proto";
  29. import "google/protobuf/timestamp.proto";
  30. import "google/rpc/status.proto";
  31. option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3";
  32. option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai";
  33. option java_multiple_files = true;
  34. option java_outer_classname = "DocumentAiProcessorService";
  35. option java_package = "com.google.cloud.documentai.v1beta3";
  36. option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3";
  37. option ruby_package = "Google::Cloud::DocumentAI::V1beta3";
  38. option (google.api.resource_definition) = {
  39. type: "documentai.googleapis.com/HumanReviewConfig"
  40. pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig"
  41. };
  42. option (google.api.resource_definition) = {
  43. type: "documentai.googleapis.com/Location"
  44. pattern: "projects/{project}/locations/{location}"
  45. };
  46. // Service to call Cloud DocumentAI to process documents according to the
  47. // processor's definition. Processors are built using state-of-the-art Google
  48. // AI such as natural language, computer vision, and translation to extract
  49. // structured information from unstructured or semi-structured documents.
  50. service DocumentProcessorService {
  51. option (google.api.default_host) = "documentai.googleapis.com";
  52. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  53. // Processes a single document.
  54. rpc ProcessDocument(ProcessRequest) returns (ProcessResponse) {
  55. option (google.api.http) = {
  56. post: "/v1beta3/{name=projects/*/locations/*/processors/*}:process"
  57. body: "*"
  58. additional_bindings {
  59. post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:process"
  60. body: "*"
  61. }
  62. };
  63. option (google.api.method_signature) = "name";
  64. }
  65. // LRO endpoint to batch process many documents. The output is written
  66. // to Cloud Storage as JSON in the [Document] format.
  67. rpc BatchProcessDocuments(BatchProcessRequest) returns (google.longrunning.Operation) {
  68. option (google.api.http) = {
  69. post: "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess"
  70. body: "*"
  71. additional_bindings {
  72. post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess"
  73. body: "*"
  74. }
  75. };
  76. option (google.api.method_signature) = "name";
  77. option (google.longrunning.operation_info) = {
  78. response_type: "BatchProcessResponse"
  79. metadata_type: "BatchProcessMetadata"
  80. };
  81. }
  82. // Fetches processor types. Note that we do not use ListProcessorTypes here
  83. // because it is not paginated.
  84. rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) {
  85. option (google.api.http) = {
  86. get: "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes"
  87. };
  88. option (google.api.method_signature) = "parent";
  89. }
  90. // Lists the processor types that exist.
  91. rpc ListProcessorTypes(ListProcessorTypesRequest) returns (ListProcessorTypesResponse) {
  92. option (google.api.http) = {
  93. get: "/v1beta3/{parent=projects/*/locations/*}/processorTypes"
  94. };
  95. option (google.api.method_signature) = "parent";
  96. }
  97. // Lists all processors which belong to this project.
  98. rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) {
  99. option (google.api.http) = {
  100. get: "/v1beta3/{parent=projects/*/locations/*}/processors"
  101. };
  102. option (google.api.method_signature) = "parent";
  103. }
  104. // Gets a processor detail.
  105. rpc GetProcessor(GetProcessorRequest) returns (Processor) {
  106. option (google.api.http) = {
  107. get: "/v1beta3/{name=projects/*/locations/*/processors/*}"
  108. };
  109. option (google.api.method_signature) = "name";
  110. }
  111. // Trains a new processor version.
  112. // Operation metadata is returned as
  113. // cloud_documentai_core.TrainProcessorVersionMetadata.
  114. rpc TrainProcessorVersion(TrainProcessorVersionRequest) returns (google.longrunning.Operation) {
  115. option (google.api.http) = {
  116. post: "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions:train"
  117. body: "*"
  118. };
  119. option (google.api.method_signature) = "parent,processor_version";
  120. option (google.longrunning.operation_info) = {
  121. response_type: "TrainProcessorVersionResponse"
  122. metadata_type: "TrainProcessorVersionMetadata"
  123. };
  124. }
  125. // Gets a processor version detail.
  126. rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion) {
  127. option (google.api.http) = {
  128. get: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}"
  129. };
  130. option (google.api.method_signature) = "name";
  131. }
  132. // Lists all versions of a processor.
  133. rpc ListProcessorVersions(ListProcessorVersionsRequest) returns (ListProcessorVersionsResponse) {
  134. option (google.api.http) = {
  135. get: "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions"
  136. };
  137. option (google.api.method_signature) = "parent";
  138. }
  139. // Deletes the processor version, all artifacts under the processor version
  140. // will be deleted.
  141. rpc DeleteProcessorVersion(DeleteProcessorVersionRequest) returns (google.longrunning.Operation) {
  142. option (google.api.http) = {
  143. delete: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}"
  144. };
  145. option (google.api.method_signature) = "name";
  146. option (google.longrunning.operation_info) = {
  147. response_type: "google.protobuf.Empty"
  148. metadata_type: "DeleteProcessorVersionMetadata"
  149. };
  150. }
  151. // Deploys the processor version.
  152. rpc DeployProcessorVersion(DeployProcessorVersionRequest) returns (google.longrunning.Operation) {
  153. option (google.api.http) = {
  154. post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy"
  155. body: "*"
  156. };
  157. option (google.api.method_signature) = "name";
  158. option (google.longrunning.operation_info) = {
  159. response_type: "DeployProcessorVersionResponse"
  160. metadata_type: "DeployProcessorVersionMetadata"
  161. };
  162. }
  163. // Undeploys the processor version.
  164. rpc UndeployProcessorVersion(UndeployProcessorVersionRequest) returns (google.longrunning.Operation) {
  165. option (google.api.http) = {
  166. post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy"
  167. body: "*"
  168. };
  169. option (google.api.method_signature) = "name";
  170. option (google.longrunning.operation_info) = {
  171. response_type: "UndeployProcessorVersionResponse"
  172. metadata_type: "UndeployProcessorVersionMetadata"
  173. };
  174. }
  175. // Creates a processor from the type processor that the user chose.
  176. // The processor will be at "ENABLED" state by default after its creation.
  177. rpc CreateProcessor(CreateProcessorRequest) returns (Processor) {
  178. option (google.api.http) = {
  179. post: "/v1beta3/{parent=projects/*/locations/*}/processors"
  180. body: "processor"
  181. };
  182. option (google.api.method_signature) = "parent,processor";
  183. }
  184. // Deletes the processor, unloads all deployed model artifacts if it was
  185. // enabled and then deletes all artifacts associated with this processor.
  186. rpc DeleteProcessor(DeleteProcessorRequest) returns (google.longrunning.Operation) {
  187. option (google.api.http) = {
  188. delete: "/v1beta3/{name=projects/*/locations/*/processors/*}"
  189. };
  190. option (google.api.method_signature) = "name";
  191. option (google.longrunning.operation_info) = {
  192. response_type: "google.protobuf.Empty"
  193. metadata_type: "DeleteProcessorMetadata"
  194. };
  195. }
  196. // Enables a processor
  197. rpc EnableProcessor(EnableProcessorRequest) returns (google.longrunning.Operation) {
  198. option (google.api.http) = {
  199. post: "/v1beta3/{name=projects/*/locations/*/processors/*}:enable"
  200. body: "*"
  201. };
  202. option (google.longrunning.operation_info) = {
  203. response_type: "EnableProcessorResponse"
  204. metadata_type: "EnableProcessorMetadata"
  205. };
  206. }
  207. // Disables a processor
  208. rpc DisableProcessor(DisableProcessorRequest) returns (google.longrunning.Operation) {
  209. option (google.api.http) = {
  210. post: "/v1beta3/{name=projects/*/locations/*/processors/*}:disable"
  211. body: "*"
  212. };
  213. option (google.longrunning.operation_info) = {
  214. response_type: "DisableProcessorResponse"
  215. metadata_type: "DisableProcessorMetadata"
  216. };
  217. }
  218. // Set the default (active) version of a [Processor][google.cloud.documentai.v1beta3.Processor] that will be used in
  219. // [ProcessDocument][google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument] and
  220. // [BatchProcessDocuments][google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments].
  221. rpc SetDefaultProcessorVersion(SetDefaultProcessorVersionRequest) returns (google.longrunning.Operation) {
  222. option (google.api.http) = {
  223. post: "/v1beta3/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion"
  224. body: "*"
  225. };
  226. option (google.longrunning.operation_info) = {
  227. response_type: "SetDefaultProcessorVersionResponse"
  228. metadata_type: "SetDefaultProcessorVersionMetadata"
  229. };
  230. }
  231. // Send a document for Human Review. The input document should be processed by
  232. // the specified processor.
  233. rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) {
  234. option (google.api.http) = {
  235. post: "/v1beta3/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument"
  236. body: "*"
  237. };
  238. option (google.api.method_signature) = "human_review_config";
  239. option (google.longrunning.operation_info) = {
  240. response_type: "ReviewDocumentResponse"
  241. metadata_type: "ReviewDocumentOperationMetadata"
  242. };
  243. }
  244. // Evaluates a ProcessorVersion against annotated documents, producing an
  245. // Evaluation.
  246. rpc EvaluateProcessorVersion(EvaluateProcessorVersionRequest) returns (google.longrunning.Operation) {
  247. option (google.api.http) = {
  248. post: "/v1beta3/{processor_version=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion"
  249. body: "*"
  250. };
  251. option (google.api.method_signature) = "processor_version";
  252. option (google.longrunning.operation_info) = {
  253. response_type: "EvaluateProcessorVersionResponse"
  254. metadata_type: "EvaluateProcessorVersionMetadata"
  255. };
  256. }
  257. // Retrieves a specific evaluation.
  258. rpc GetEvaluation(GetEvaluationRequest) returns (Evaluation) {
  259. option (google.api.http) = {
  260. get: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}"
  261. };
  262. option (google.api.method_signature) = "name";
  263. }
  264. // Retrieves a set of evaluations for a given processor version.
  265. rpc ListEvaluations(ListEvaluationsRequest) returns (ListEvaluationsResponse) {
  266. option (google.api.http) = {
  267. get: "/v1beta3/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations"
  268. };
  269. option (google.api.method_signature) = "parent";
  270. }
  271. }
  272. // Request message for the process document method.
  273. message ProcessRequest {
  274. // The document payload.
  275. oneof source {
  276. // An inline document proto.
  277. Document inline_document = 4;
  278. // A raw document content (bytes).
  279. RawDocument raw_document = 5;
  280. }
  281. // Required. The resource name of the [Processor][google.cloud.documentai.v1beta3.Processor] or
  282. // [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion]
  283. // to use for processing. If a [Processor][google.cloud.documentai.v1beta3.Processor] is specified, the server will use
  284. // its [default version][google.cloud.documentai.v1beta3.Processor.default_processor_version]. Format:
  285. // `projects/{project}/locations/{location}/processors/{processor}`, or
  286. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
  287. string name = 1 [
  288. (google.api.field_behavior) = REQUIRED,
  289. (google.api.resource_reference) = {
  290. type: "*"
  291. }
  292. ];
  293. // The document payload, the [content] and [mime_type] fields must be set.
  294. Document document = 2 [deprecated = true];
  295. // Whether Human Review feature should be skipped for this request. Default to
  296. // false.
  297. bool skip_human_review = 3;
  298. // Specifies which fields to include in ProcessResponse's document.
  299. // Only supports top level document and pages field so it must be in the form
  300. // of `{document_field_name}` or `pages.{page_field_name}`.
  301. google.protobuf.FieldMask field_mask = 6;
  302. }
  303. // The status of human review on a processed document.
  304. message HumanReviewStatus {
  305. // The final state of human review on a processed document.
  306. enum State {
  307. // Human review state is unspecified. Most likely due to an internal error.
  308. STATE_UNSPECIFIED = 0;
  309. // Human review is skipped for the document. This can happen because human
  310. // review is not enabled on the processor or the processing request has
  311. // been set to skip this document.
  312. SKIPPED = 1;
  313. // Human review validation is triggered and passed, so no review is needed.
  314. VALIDATION_PASSED = 2;
  315. // Human review validation is triggered and the document is under review.
  316. IN_PROGRESS = 3;
  317. // Some error happened during triggering human review, see the
  318. // [state_message] for details.
  319. ERROR = 4;
  320. }
  321. // The state of human review on the processing request.
  322. State state = 1;
  323. // A message providing more details about the human review state.
  324. string state_message = 2;
  325. // The name of the operation triggered by the processed document. This field
  326. // is populated only when the [state] is [HUMAN_REVIEW_IN_PROGRESS]. It has
  327. // the same response type and metadata as the long running operation returned
  328. // by [ReviewDocument] method.
  329. string human_review_operation = 3;
  330. }
  331. // Response message for the process document method.
  332. message ProcessResponse {
  333. // The document payload, will populate fields based on the processor's
  334. // behavior.
  335. Document document = 1;
  336. // The name of the operation triggered by the processed document. If the human
  337. // review process is not triggered, this field will be empty. It has the same
  338. // response type and metadata as the long running operation returned by
  339. // ReviewDocument method.
  340. string human_review_operation = 2 [deprecated = true];
  341. // The status of human review on the processed document.
  342. HumanReviewStatus human_review_status = 3;
  343. }
  344. // Request message for batch process document method.
  345. message BatchProcessRequest {
  346. // The message for input config in batch process.
  347. message BatchInputConfig {
  348. option deprecated = true;
  349. // The Cloud Storage location as the source of the document.
  350. string gcs_source = 1;
  351. // Mimetype of the input. If the input is a raw document, the supported
  352. // mimetypes are application/pdf, image/tiff, and image/gif.
  353. // If the input is a [Document] proto, the type should be application/json.
  354. string mime_type = 2;
  355. }
  356. // The message for output config in batch process.
  357. message BatchOutputConfig {
  358. option deprecated = true;
  359. // The output Cloud Storage directory to put the processed documents.
  360. string gcs_destination = 1;
  361. }
  362. // Required. The resource name of [Processor][google.cloud.documentai.v1beta3.Processor] or
  363. // [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion].
  364. // Format: `projects/{project}/locations/{location}/processors/{processor}`,
  365. // or
  366. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
  367. string name = 1 [
  368. (google.api.field_behavior) = REQUIRED,
  369. (google.api.resource_reference) = {
  370. type: "*"
  371. }
  372. ];
  373. // The input config for each single document in the batch process.
  374. repeated BatchInputConfig input_configs = 2 [deprecated = true];
  375. // The overall output config for batch process.
  376. BatchOutputConfig output_config = 3 [deprecated = true];
  377. // The input documents for batch process.
  378. BatchDocumentsInputConfig input_documents = 5;
  379. // The overall output config for batch process.
  380. DocumentOutputConfig document_output_config = 6;
  381. // Whether Human Review feature should be skipped for this request. Default to
  382. // false.
  383. bool skip_human_review = 4;
  384. }
  385. // Response message for batch process document method.
  386. message BatchProcessResponse {
  387. }
  388. // The long running operation metadata for batch process method.
  389. message BatchProcessMetadata {
  390. // The status of a each individual document in the batch process.
  391. message IndividualProcessStatus {
  392. // The source of the document, same as the [input_gcs_source] field in the
  393. // request when the batch process started. The batch process is started by
  394. // take snapshot of that document, since a user can move or change that
  395. // document during the process.
  396. string input_gcs_source = 1;
  397. // The status processing the document.
  398. google.rpc.Status status = 2;
  399. // The output_gcs_destination (in the request as `output_gcs_destination`)
  400. // of the processed document if it was successful, otherwise empty.
  401. string output_gcs_destination = 3;
  402. // The name of the operation triggered by the processed document. If the
  403. // human review process is not triggered, this field will be empty. It has
  404. // the same response type and metadata as the long running operation
  405. // returned by ReviewDocument method.
  406. string human_review_operation = 4 [deprecated = true];
  407. // The status of human review on the processed document.
  408. HumanReviewStatus human_review_status = 5;
  409. }
  410. // Possible states of the batch processing operation.
  411. enum State {
  412. // The default value. This value is used if the state is omitted.
  413. STATE_UNSPECIFIED = 0;
  414. // Request operation is waiting for scheduling.
  415. WAITING = 1;
  416. // Request is being processed.
  417. RUNNING = 2;
  418. // The batch processing completed successfully.
  419. SUCCEEDED = 3;
  420. // The batch processing was being cancelled.
  421. CANCELLING = 4;
  422. // The batch processing was cancelled.
  423. CANCELLED = 5;
  424. // The batch processing has failed.
  425. FAILED = 6;
  426. }
  427. // The state of the current batch processing.
  428. State state = 1;
  429. // A message providing more details about the current state of processing.
  430. // For example, the error message if the operation is failed.
  431. string state_message = 2;
  432. // The creation time of the operation.
  433. google.protobuf.Timestamp create_time = 3;
  434. // The last update time of the operation.
  435. google.protobuf.Timestamp update_time = 4;
  436. // The list of response details of each document.
  437. repeated IndividualProcessStatus individual_process_statuses = 5;
  438. }
  439. // Request message for fetch processor types.
  440. message FetchProcessorTypesRequest {
  441. // Required. The project of processor type to list.
  442. // The available processor types may depend on the allow-listing on projects.
  443. // Format: `projects/{project}/locations/{location}`
  444. string parent = 1 [
  445. (google.api.field_behavior) = REQUIRED,
  446. (google.api.resource_reference) = {
  447. child_type: "documentai.googleapis.com/ProcessorType"
  448. }
  449. ];
  450. }
  451. // Response message for fetch processor types.
  452. message FetchProcessorTypesResponse {
  453. // The list of processor types.
  454. repeated ProcessorType processor_types = 1;
  455. }
  456. // Request message for list processor types.
  457. message ListProcessorTypesRequest {
  458. // Required. The location of processor type to list.
  459. // The available processor types may depend on the allow-listing on projects.
  460. // Format: `projects/{project}/locations/{location}`
  461. string parent = 1 [
  462. (google.api.field_behavior) = REQUIRED,
  463. (google.api.resource_reference) = {
  464. child_type: "documentai.googleapis.com/ProcessorType"
  465. }
  466. ];
  467. // The maximum number of processor types to return.
  468. // If unspecified, at most 100 processor types will be returned.
  469. // The maximum value is 500; values above 500 will be coerced to 500.
  470. int32 page_size = 2;
  471. // Used to retrieve the next page of results, empty if at the end of the list.
  472. string page_token = 3;
  473. }
  474. // Response message for list processor types.
  475. message ListProcessorTypesResponse {
  476. // The processor types.
  477. repeated ProcessorType processor_types = 1;
  478. // Points to the next page, otherwise empty.
  479. string next_page_token = 2;
  480. }
  481. // Request message for list all processors belongs to a project.
  482. message ListProcessorsRequest {
  483. // Required. The parent (project and location) which owns this collection of Processors.
  484. // Format: `projects/{project}/locations/{location}`
  485. string parent = 1 [
  486. (google.api.field_behavior) = REQUIRED,
  487. (google.api.resource_reference) = {
  488. child_type: "documentai.googleapis.com/Processor"
  489. }
  490. ];
  491. // The maximum number of processors to return.
  492. // If unspecified, at most 50 processors will be returned.
  493. // The maximum value is 100; values above 100 will be coerced to 100.
  494. int32 page_size = 2;
  495. // We will return the processors sorted by creation time. The page token
  496. // will point to the next processor.
  497. string page_token = 3;
  498. }
  499. // Response message for list processors.
  500. message ListProcessorsResponse {
  501. // The list of processors.
  502. repeated Processor processors = 1;
  503. // Points to the next processor, otherwise empty.
  504. string next_page_token = 2;
  505. }
  506. // Request message for get processor.
  507. message GetProcessorRequest {
  508. // Required. The processor resource name.
  509. string name = 1 [
  510. (google.api.field_behavior) = REQUIRED,
  511. (google.api.resource_reference) = {
  512. type: "documentai.googleapis.com/Processor"
  513. }
  514. ];
  515. }
  516. // Request message for get processor version.
  517. message GetProcessorVersionRequest {
  518. // Required. The processor resource name.
  519. string name = 1 [
  520. (google.api.field_behavior) = REQUIRED,
  521. (google.api.resource_reference) = {
  522. type: "documentai.googleapis.com/ProcessorVersion"
  523. }
  524. ];
  525. }
  526. // Request message for list all processor versions belongs to a processor.
  527. message ListProcessorVersionsRequest {
  528. // Required. The parent (project, location and processor) to list all versions.
  529. // Format: `projects/{project}/locations/{location}/processors/{processor}`
  530. string parent = 1 [
  531. (google.api.field_behavior) = REQUIRED,
  532. (google.api.resource_reference) = {
  533. child_type: "documentai.googleapis.com/ProcessorVersion"
  534. }
  535. ];
  536. // The maximum number of processor versions to return.
  537. // If unspecified, at most 10 processor versions will be returned.
  538. // The maximum value is 20; values above 20 will be coerced to 20.
  539. int32 page_size = 2;
  540. // We will return the processor versions sorted by creation time. The page
  541. // token will point to the next processor version.
  542. string page_token = 3;
  543. }
  544. // Response message for list processors.
  545. message ListProcessorVersionsResponse {
  546. // The list of processors.
  547. repeated ProcessorVersion processor_versions = 1;
  548. // Points to the next processor, otherwise empty.
  549. string next_page_token = 2;
  550. }
  551. // Request message for the delete processor version method.
  552. message DeleteProcessorVersionRequest {
  553. // Required. The processor version resource name to be deleted.
  554. string name = 1 [
  555. (google.api.field_behavior) = REQUIRED,
  556. (google.api.resource_reference) = {
  557. type: "documentai.googleapis.com/ProcessorVersion"
  558. }
  559. ];
  560. }
  561. // The long running operation metadata for delete processor version method.
  562. message DeleteProcessorVersionMetadata {
  563. // The basic metadata of the long running operation.
  564. CommonOperationMetadata common_metadata = 1;
  565. }
  566. // Request message for the deploy processor version method.
  567. message DeployProcessorVersionRequest {
  568. // Required. The processor version resource name to be deployed.
  569. string name = 1 [
  570. (google.api.field_behavior) = REQUIRED,
  571. (google.api.resource_reference) = {
  572. type: "documentai.googleapis.com/ProcessorVersion"
  573. }
  574. ];
  575. }
  576. // Response message for the deploy processor version method.
  577. message DeployProcessorVersionResponse {
  578. }
  579. // The long running operation metadata for deploy processor version method.
  580. message DeployProcessorVersionMetadata {
  581. // The basic metadata of the long running operation.
  582. CommonOperationMetadata common_metadata = 1;
  583. }
  584. // Request message for the undeploy processor version method.
  585. message UndeployProcessorVersionRequest {
  586. // Required. The processor version resource name to be undeployed.
  587. string name = 1 [
  588. (google.api.field_behavior) = REQUIRED,
  589. (google.api.resource_reference) = {
  590. type: "documentai.googleapis.com/ProcessorVersion"
  591. }
  592. ];
  593. }
  594. // Response message for the undeploy processor version method.
  595. message UndeployProcessorVersionResponse {
  596. }
  597. // The long running operation metadata for the undeploy processor version
  598. // method.
  599. message UndeployProcessorVersionMetadata {
  600. // The basic metadata of the long running operation.
  601. CommonOperationMetadata common_metadata = 1;
  602. }
  603. // Request message for create a processor. Notice this request is sent to
  604. // a regionalized backend service, and if the processor type is not available
  605. // on that region, the creation will fail.
  606. message CreateProcessorRequest {
  607. // Required. The parent (project and location) under which to create the processor.
  608. // Format: `projects/{project}/locations/{location}`
  609. string parent = 1 [
  610. (google.api.field_behavior) = REQUIRED,
  611. (google.api.resource_reference) = {
  612. child_type: "documentai.googleapis.com/Processor"
  613. }
  614. ];
  615. // Required. The processor to be created, requires [processor_type] and [display_name]
  616. // to be set. Also, the processor is under CMEK if CMEK fields are set.
  617. Processor processor = 2 [(google.api.field_behavior) = REQUIRED];
  618. }
  619. // Request message for the delete processor method.
  620. message DeleteProcessorRequest {
  621. // Required. The processor resource name to be deleted.
  622. string name = 1 [
  623. (google.api.field_behavior) = REQUIRED,
  624. (google.api.resource_reference) = {
  625. type: "documentai.googleapis.com/Processor"
  626. }
  627. ];
  628. }
  629. // The long running operation metadata for delete processor method.
  630. message DeleteProcessorMetadata {
  631. // The basic metadata of the long running operation.
  632. CommonOperationMetadata common_metadata = 5;
  633. }
  634. // Request message for the enable processor method.
  635. message EnableProcessorRequest {
  636. // Required. The processor resource name to be enabled.
  637. string name = 1 [
  638. (google.api.field_behavior) = REQUIRED,
  639. (google.api.resource_reference) = {
  640. type: "documentai.googleapis.com/Processor"
  641. }
  642. ];
  643. }
  644. // Response message for the enable processor method.
  645. // Intentionally empty proto for adding fields in future.
  646. message EnableProcessorResponse {
  647. }
  648. // The long running operation metadata for enable processor method.
  649. message EnableProcessorMetadata {
  650. // The basic metadata of the long running operation.
  651. CommonOperationMetadata common_metadata = 5;
  652. }
  653. // Request message for the disable processor method.
  654. message DisableProcessorRequest {
  655. // Required. The processor resource name to be disabled.
  656. string name = 1 [
  657. (google.api.field_behavior) = REQUIRED,
  658. (google.api.resource_reference) = {
  659. type: "documentai.googleapis.com/Processor"
  660. }
  661. ];
  662. }
  663. // Response message for the disable processor method.
  664. // Intentionally empty proto for adding fields in future.
  665. message DisableProcessorResponse {
  666. }
  667. // The long running operation metadata for disable processor method.
  668. message DisableProcessorMetadata {
  669. // The basic metadata of the long running operation.
  670. CommonOperationMetadata common_metadata = 5;
  671. }
  672. // Request message for the set default processor version method.
  673. message SetDefaultProcessorVersionRequest {
  674. // Required. The resource name of the [Processor][google.cloud.documentai.v1beta3.Processor] to change default version.
  675. string processor = 1 [
  676. (google.api.field_behavior) = REQUIRED,
  677. (google.api.resource_reference) = {
  678. type: "documentai.googleapis.com/Processor"
  679. }
  680. ];
  681. // Required. The resource name of child [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to use as default.
  682. // Format:
  683. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
  684. string default_processor_version = 2 [
  685. (google.api.field_behavior) = REQUIRED,
  686. (google.api.resource_reference) = {
  687. type: "documentai.googleapis.com/ProcessorVersion"
  688. }
  689. ];
  690. }
  691. // Response message for set default processor version method.
  692. message SetDefaultProcessorVersionResponse {
  693. }
  694. // The long running operation metadata for set default processor version
  695. // method.
  696. message SetDefaultProcessorVersionMetadata {
  697. // The basic metadata of the long running operation.
  698. CommonOperationMetadata common_metadata = 1;
  699. }
  700. // Request message for the create processor version method.
  701. message TrainProcessorVersionRequest {
  702. // The input data used to train a new `ProcessorVersion`.
  703. message InputData {
  704. // The documents used for training the new version.
  705. BatchDocumentsInputConfig training_documents = 3;
  706. // The documents used for testing the trained version.
  707. BatchDocumentsInputConfig test_documents = 4;
  708. }
  709. // Required. The parent (project, location and processor) to create the new version for.
  710. // Format: `projects/{project}/locations/{location}/processors/{processor}`.
  711. string parent = 1 [
  712. (google.api.field_behavior) = REQUIRED,
  713. (google.api.resource_reference) = {
  714. child_type: "documentai.googleapis.com/ProcessorVersion"
  715. }
  716. ];
  717. // Required. The processor version to be created.
  718. ProcessorVersion processor_version = 2 [(google.api.field_behavior) = REQUIRED];
  719. // Optional. The schema the processor version will be trained with.
  720. DocumentSchema document_schema = 10 [(google.api.field_behavior) = OPTIONAL];
  721. // Optional. The input data used to train the `ProcessorVersion`.
  722. InputData input_data = 4 [(google.api.field_behavior) = OPTIONAL];
  723. // Optional. The processor version to use as a base for training. This processor version
  724. // must be a child of `parent`. Format:
  725. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
  726. string base_processor_version = 8 [(google.api.field_behavior) = OPTIONAL];
  727. }
  728. // The response for the TrainProcessorVersion method.
  729. message TrainProcessorVersionResponse {
  730. // The resource name of the processor version produced by training.
  731. string processor_version = 1;
  732. }
  733. // The metadata that represents a processor version being created.
  734. message TrainProcessorVersionMetadata {
  735. // The dataset validation information.
  736. // This includes any and all errors with documents and the dataset.
  737. message DatasetValidation {
  738. // The total number of document errors.
  739. int32 document_error_count = 3;
  740. // The total number of dataset errors.
  741. int32 dataset_error_count = 4;
  742. // Error information pertaining to specific documents. A maximum of 10
  743. // document errors will be returned.
  744. // Any document with errors will not be used throughout training.
  745. repeated google.rpc.Status document_errors = 1;
  746. // Error information for the dataset as a whole. A maximum of 10 dataset
  747. // errors will be returned.
  748. // A single dataset error is terminal for training.
  749. repeated google.rpc.Status dataset_errors = 2;
  750. }
  751. // The basic metadata of the long running operation.
  752. CommonOperationMetadata common_metadata = 1;
  753. // The training dataset validation information.
  754. DatasetValidation training_dataset_validation = 2;
  755. // The test dataset validation information.
  756. DatasetValidation test_dataset_validation = 3;
  757. }
  758. // Request message for review document method.
  759. message ReviewDocumentRequest {
  760. // The priority level of the human review task.
  761. enum Priority {
  762. // The default priority level.
  763. DEFAULT = 0;
  764. // The urgent priority level. The labeling manager should allocate labeler
  765. // resource to the urgent task queue to respect this priority level.
  766. URGENT = 1;
  767. }
  768. // The document payload.
  769. oneof source {
  770. // An inline document proto.
  771. Document inline_document = 4;
  772. }
  773. // Required. The resource name of the HumanReviewConfig that the document will be
  774. // reviewed with.
  775. string human_review_config = 1 [
  776. (google.api.field_behavior) = REQUIRED,
  777. (google.api.resource_reference) = {
  778. type: "documentai.googleapis.com/HumanReviewConfig"
  779. }
  780. ];
  781. // The document that needs human review.
  782. Document document = 2 [deprecated = true];
  783. // Whether the validation should be performed on the ad-hoc review request.
  784. bool enable_schema_validation = 3;
  785. // The priority of the human review task.
  786. Priority priority = 5;
  787. // The document schema of the human review task.
  788. DocumentSchema document_schema = 6;
  789. }
  790. // Response message for review document method.
  791. message ReviewDocumentResponse {
  792. // Possible states of the review operation.
  793. enum State {
  794. // The default value. This value is used if the state is omitted.
  795. STATE_UNSPECIFIED = 0;
  796. // The review operation is rejected by the reviewer.
  797. REJECTED = 1;
  798. // The review operation is succeeded.
  799. SUCCEEDED = 2;
  800. }
  801. // The Cloud Storage uri for the human reviewed document if the review is
  802. // succeeded.
  803. string gcs_destination = 1;
  804. // The state of the review operation.
  805. State state = 2;
  806. // The reason why the review is rejected by reviewer.
  807. string rejection_reason = 3;
  808. }
  809. // The long running operation metadata for review document method.
  810. message ReviewDocumentOperationMetadata {
  811. // State of the longrunning operation.
  812. enum State {
  813. // Unspecified state.
  814. STATE_UNSPECIFIED = 0;
  815. // Operation is still running.
  816. RUNNING = 1;
  817. // Operation is being cancelled.
  818. CANCELLING = 2;
  819. // Operation succeeded.
  820. SUCCEEDED = 3;
  821. // Operation failed.
  822. FAILED = 4;
  823. // Operation is cancelled.
  824. CANCELLED = 5;
  825. }
  826. // Used only when Operation.done is false.
  827. State state = 1;
  828. // A message providing more details about the current state of processing.
  829. // For example, the error message if the operation is failed.
  830. string state_message = 2;
  831. // The creation time of the operation.
  832. google.protobuf.Timestamp create_time = 3;
  833. // The last update time of the operation.
  834. google.protobuf.Timestamp update_time = 4;
  835. // The basic metadata of the long running operation.
  836. CommonOperationMetadata common_metadata = 5;
  837. // The Crowd Compute question ID.
  838. string question_id = 6;
  839. }
  840. // Evaluates the given ProcessorVersion against the supplied documents.
  841. message EvaluateProcessorVersionRequest {
  842. // Required. The resource name of the [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to evaluate.
  843. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
  844. string processor_version = 1 [
  845. (google.api.field_behavior) = REQUIRED,
  846. (google.api.resource_reference) = {
  847. type: "documentai.googleapis.com/ProcessorVersion"
  848. }
  849. ];
  850. // Optional. The documents used in the evaluation. If unspecified, use the processor's
  851. // dataset as evaluation input.
  852. BatchDocumentsInputConfig evaluation_documents = 3 [(google.api.field_behavior) = OPTIONAL];
  853. }
  854. // Metadata of the EvaluateProcessorVersion method.
  855. message EvaluateProcessorVersionMetadata {
  856. // The basic metadata of the long running operation.
  857. CommonOperationMetadata common_metadata = 1;
  858. }
  859. // Metadata of the EvaluateProcessorVersion method.
  860. message EvaluateProcessorVersionResponse {
  861. // The resource name of the created evaluation.
  862. string evaluation = 2;
  863. }
  864. // Retrieves a specific Evaluation.
  865. message GetEvaluationRequest {
  866. // Required. The resource name of the [Evaluation][google.cloud.documentai.v1beta3.Evaluation] to get.
  867. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
  868. string name = 1 [
  869. (google.api.field_behavior) = REQUIRED,
  870. (google.api.resource_reference) = {
  871. type: "documentai.googleapis.com/Evaluation"
  872. }
  873. ];
  874. }
  875. // Retrieves a list of evaluations for a given ProcessorVersion.
  876. message ListEvaluationsRequest {
  877. // Required. The resource name of the [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to list evaluations for.
  878. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
  879. string parent = 1 [
  880. (google.api.field_behavior) = REQUIRED,
  881. (google.api.resource_reference) = {
  882. type: "documentai.googleapis.com/ProcessorVersion"
  883. }
  884. ];
  885. // The standard list page size.
  886. // If unspecified, at most 5 evaluations will be returned.
  887. // The maximum value is 100; values above 100 will be coerced to 100.
  888. int32 page_size = 2;
  889. // A page token, received from a previous `ListEvaluations` call.
  890. // Provide this to retrieve the subsequent page.
  891. string page_token = 3;
  892. }
  893. // The response from ListEvaluations.
  894. message ListEvaluationsResponse {
  895. // The evaluations requested.
  896. repeated Evaluation evaluations = 1;
  897. // A token, which can be sent as `page_token` to retrieve the next page.
  898. // If this field is omitted, there are no subsequent pages.
  899. string next_page_token = 2;
  900. }