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).
A lazy loader for Documents.
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" ... )
- Parameters
file_path (str) –
client (Any) –
model (str) –
headers (Optional[Dict]) –
- Return type
None
- async alazy_load() AsyncIterator[Document] ¶
A lazy loader for Documents.
- Return type
AsyncIterator[Document]
- lazy_load() Iterator[Document] [source]¶
Lazy load given path as pages.
- Return type
Iterator[Document]
- load_and_split(text_splitter: Optional[TextSplitter] = 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 (Optional[Dict]) –