DocumentIntelligenceLoader#

class langchain_community.document_loaders.pdf.DocumentIntelligenceLoader(file_path: str, client: Any, model: str = 'prebuilt-document', headers: Dict | None = None)[source]#

Load a PDF with Azure Document Intelligence

Initialize the object for file processing with Azure Document Intelligence (formerly Form Recognizer).

This constructor initializes a DocumentIntelligenceParser object to be used for parsing files using the Azure Document Intelligence API. The load method generates a Document node including metadata (source blob and page number) for each page.

Parameters:#

file_pathstr

The path to the file that needs to be parsed.

client: Any

A DocumentAnalysisClient to perform the analysis of the blob

modelstr

The model name or ID to be used for form recognition in Azure.

Examples:#

>>> obj = DocumentIntelligenceLoader(
...     file_path="path/to/file",
...     client=client,
...     model="prebuilt-document"
... )

Attributes

source

Methods

__init__(file_path, client[, model, headers])

Initialize the object for file processing with Azure Document Intelligence (formerly Form Recognizer).

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

lazy_load()

Lazy load given path as pages.

load()

Load given path as pages.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(file_path: str, client: Any, model: str = 'prebuilt-document', headers: Dict | None = None) None[source]#

Initialize the object for file processing with Azure Document Intelligence (formerly Form Recognizer).

This constructor initializes a DocumentIntelligenceParser object to be used for parsing files using the Azure Document Intelligence API. The load method generates a Document node including metadata (source blob and page number) for each page.

Parameters:#

file_pathstr

The path to the file that needs to be parsed.

client: Any

A DocumentAnalysisClient to perform the analysis of the blob

modelstr

The model name or ID to be used for form recognition in Azure.

Examples:#

>>> obj = DocumentIntelligenceLoader(
...     file_path="path/to/file",
...     client=client,
...     model="prebuilt-document"
... )
Parameters:
  • file_path (str)

  • client (Any)

  • model (str)

  • headers (Dict | None)

Return type:

None

async alazy_load() AsyncIterator[Document]#

A lazy loader for Documents.

Return type:

AsyncIterator[Document]

async aload() list[Document]#

Load data into Document objects.

Return type:

list[Document]

lazy_load() Iterator[Document][source]#

Lazy load given path as pages.

Return type:

Iterator[Document]

load() List[Document][source]#

Load given path as pages.

Return type:

List[Document]

load_and_split(text_splitter: TextSplitter | None = None) list[Document]#

Load Documents and split into chunks. Chunks are returned as Documents.

Do not override this method. It should be considered to be deprecated!

Parameters:

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns:

List of Documents.

Return type:

list[Document]

Parameters:
  • file_path (str)

  • client (Any)

  • model (str)

  • headers (Dict | None)