GCP.DocumentAI reference
GetProcessor
Section titled “GetProcessor”Source:
src/GCP/DocumentAI/GetProcessor.ts
Runtime binding for Document AI processors.get.
Bind this operation to a Processor in a Function/Action init
phase. Provide GetProcessorHttp.
GetProcessor: Reading a Processor
Section titled “GetProcessor: Reading a Processor”const getProcessor = yield* GCP.DocumentAI.GetProcessor(processor);const live = yield* getProcessor();GetProcessorHttp
Section titled “GetProcessorHttp”Source:
src/GCP/DocumentAI/GetProcessorHttp.tsKind: Layer · Provides:GCP.DocumentAI.GetProcessor
HTTP implementation of GetProcessor.
GetSchema
Section titled “GetSchema”Source:
src/GCP/DocumentAI/GetSchema.ts
Runtime binding for Document AI schemas.get.
Bind this operation to a Schema in a Function/Action init
phase. Provide GetSchemaHttp.
GetSchema: Reading a Schema
Section titled “GetSchema: Reading a Schema”const getSchema = yield* GCP.DocumentAI.GetSchema(schema);const live = yield* getSchema();GetSchemaHttp
Section titled “GetSchemaHttp”Source:
src/GCP/DocumentAI/GetSchemaHttp.tsKind: Layer · Provides:GCP.DocumentAI.GetSchema
HTTP implementation of GetSchema.
GetSchemaVersion
Section titled “GetSchemaVersion”Source:
src/GCP/DocumentAI/GetSchemaVersion.ts
Runtime binding for Document AI schemaVersions.get.
Bind this operation to a SchemasSchemaVersion in a
Function/Action init phase. Provide GetSchemaVersionHttp.
GetSchemaVersion: Reading a Schema Version
Section titled “GetSchemaVersion: Reading a Schema Version”const getVersion = yield* GCP.DocumentAI.GetSchemaVersion(version);const live = yield* getVersion();GetSchemaVersionHttp
Section titled “GetSchemaVersionHttp”Source:
src/GCP/DocumentAI/GetSchemaVersionHttp.tsKind: Layer · Provides:GCP.DocumentAI.GetSchemaVersion
HTTP implementation of GetSchemaVersion.
Process
Section titled “Process”Source:
src/GCP/DocumentAI/Process.ts
Runtime binding for Document AI processors.process.
Bind this operation to a Processor in a Function/Action init
phase. Provide ProcessHttp.
Process: Processing a Document
Section titled “Process: Processing a Document”const process = yield* GCP.DocumentAI.Process(processor);const result = yield* process({ body: { rawDocument: { content: pdfBase64, mimeType: "application/pdf", }, skipHumanReview: true, },});ProcessHttp
Section titled “ProcessHttp”Source:
src/GCP/DocumentAI/ProcessHttp.tsKind: Layer · Provides:GCP.DocumentAI.Process
HTTP implementation of Process.
Processor
Section titled “Processor”Source:
src/GCP/DocumentAI/Processor.ts
A Document AI processor that extracts structure from documents.
Processors are location-scoped. The API assigns the processor id. Type,
location, KMS key, and display name are immutable (there is no processor
patch RPC). Enable / disable and the default processor version update in
place. Processors have no labels, so Alchemy stamps ownership into
displayName for list / nuke.
Processor: Creating a Processor
Section titled “Processor: Creating a Processor”OCR processor
const processor = yield* GCP.DocumentAI.Processor("Ocr", { type: "OCR_PROCESSOR", displayName: "ocr",});Explicit location
const processor = yield* GCP.DocumentAI.Processor("Ocr", { location: "us", type: "OCR_PROCESSOR",});Processor: Updating a Processor
Section titled “Processor: Updating a Processor”// Same logical id, changed props: the engine updates it in place.const processor = yield* GCP.DocumentAI.Processor("Ocr", { location: "us", type: "OCR_PROCESSOR", enabled: false,});Schema
Section titled “Schema”Source:
src/GCP/DocumentAI/Schema.ts
A Document AI schema — a collection of schema versions describing extraction output.
Schemas are location-scoped. The API assigns the schema id. Location is immutable; display name and labels update in place.
Schema: Creating a Schema
Section titled “Schema: Creating a Schema”const schema = yield* GCP.DocumentAI.Schema("Invoice", { displayName: "invoice", labels: { env: "test" },});Schema: Updating a Schema
Section titled “Schema: Updating a Schema”// Same logical id, changed props: the engine updates it in place.const schema = yield* GCP.DocumentAI.Schema("Invoice", { displayName: "invoice-v2", labels: { env: "prod" },});SchemasSchemaVersion
Section titled “SchemasSchemaVersion”Source:
src/GCP/DocumentAI/SchemasSchemaVersion.ts
A Document AI schema version — an immutable snapshot of a document schema under a Schema.
Parent schema, version id, and the document schema body are immutable. Display name and labels update in place.
SchemasSchemaVersion: Creating a Schema Version
Section titled “SchemasSchemaVersion: Creating a Schema Version”const version = yield* GCP.DocumentAI.SchemasSchemaVersion("V1", { schema: schema.name, displayName: "v1", documentSchema: { displayName: "invoice", entityTypes: [ { name: "invoice", baseTypes: ["document"], properties: [ { name: "invoice_id", valueType: "string", occurrenceType: "OPTIONAL_ONCE", }, ], }, ], },});