forked from langchain-ai/langchain-google
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Google Cloud Document AI Layout Parser (langchain-a…
- Loading branch information
1 parent
fc632d9
commit ed5c457
Showing
3 changed files
with
160 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Integration tests for the Google Cloud DocAI parser.""" | ||
|
||
import os | ||
|
||
import pytest | ||
from langchain_core.document_loaders.blob_loaders import Blob | ||
|
||
from langchain_google_community.docai import DocAIParser | ||
|
||
|
||
@pytest.mark.extended | ||
def test_docai_layout_parser() -> None: | ||
processor_name = os.environ["PROCESSOR_NAME"] | ||
parser = DocAIParser(processor_name=processor_name, location="us") | ||
assert parser._use_layout_parser is True | ||
blob = Blob( | ||
data=None, | ||
path="gs://cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfs/2022Q1_alphabet_earnings_release.pdf", | ||
) | ||
docs = list(parser.online_process(blob=blob)) | ||
assert len(docs) == 11 |