processor_name – name of a processor
You should provide either a client or location (and then a clientwould be instantiated).
batch_parse(blobs: Sequence[Blob], gcs_output_path: Optional[str] = None, timeout_sec: int = 3600, check_in_interval_sec: int = 60) → Iterator[Document][source]¶
Parses a list of blobs lazily.
Parameters
blobs – a list of blobs to parse
gcs_output_path – a path on GCS to store parsing results
timeout_sec – a timeout to wait for DocAI to complete, in seconds
check_in_interval_sec – an interval to wait until next check
whether parsing operations have been completed, in seconds
This is a long-running operations! A recommended way is to decoupleparsing from creating Langchain Documents:
>>> operations = parser.docai_parse(blobs, gcs_path)
>>> parser.is_running(operations)
You can get operations names and save them:
>>> names = [op.operation.name for op in operations]
And when all operations are finished, you can use their results:
>>> operations = parser.operations_from_names(operation_names)
>>> results = parser.get_results(operations)
>>> docs = parser.parse_from_results(results)
docai_parse(blobs: Sequence[Blob], *, gcs_output_path: Optional[str] = None, batch_size: int = 4000, enable_native_pdf_parsing: bool = True) → List[Operation][source]¶
Runs Google DocAI PDF parser on a list of blobs.
Parameters
blobs – a list of blobs to be parsed
gcs_output_path – a path (folder) on GCS to store results
batch_size – amount of documents per batch
enable_native_pdf_parsing – a config option for the parser