langchain_community.document_loaders.pdf.DocumentIntelligenceLoader¶

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

Loads 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).

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: Optional[Dict] = 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"
... )
lazy_load() Iterator[Document][source]¶

Lazy load given path as pages.

load() List[Document][source]¶

Load given path as pages.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]¶

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

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using DocumentIntelligenceLoader¶