Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,7 @@ def __init__(
client: Optional[Any] = None,
*,
linearization_config: Optional[TextLinearizationConfig] = None,
mime_type: Optional[str] = None,
) -> None:
"""Initializes the parser.

Expand All @@ -1553,6 +1554,7 @@ def __init__(
linearization_config: Config to be used for linearization of the output
should be an instance of TextLinearizationConfig from
the `textractor` pkg
mime_type: Mime type of the document to be parsed.
"""

try:
Expand All @@ -1561,6 +1563,7 @@ def __init__(

self.tc = tc
self.textractor = textractor
self.mime_type = mime_type

if textract_features is not None:
self.textract_features = [
Expand Down Expand Up @@ -1617,13 +1620,15 @@ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
input_document=str(blob.path),
features=self.textract_features,
boto3_textract_client=self.boto3_textract_client,
mime_type=self.mime_type,
)
else:
textract_response_json = self.tc.call_textract(
input_document=blob.as_bytes(),
features=self.textract_features,
call_mode=self.tc.Textract_Call_Mode.FORCE_SYNC,
boto3_textract_client=self.boto3_textract_client,
mime_type=self.mime_type,
)

document = self.textractor.Document.open(textract_response_json)
Expand Down
4 changes: 3 additions & 1 deletion libs/community/langchain_community/document_loaders/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ def __init__(
headers: Optional[dict] = None,
*,
linearization_config: Optional["TextLinearizationConfig"] = None,
mime_type: Optional[str] = None,
) -> None:
"""Initialize the loader.

Expand Down Expand Up @@ -1142,6 +1143,7 @@ def __init__(
textract_features=features,
client=client,
linearization_config=linearization_config,
mime_type=mime_type,
)

def load(self) -> list[Document]:
Expand Down Expand Up @@ -1380,7 +1382,7 @@ def __init__(
Hosted models are passed in format "<provider>/<model>"
Examples: "azure/gpt-4o-mini", "vertex_ai/gemini-1.5-flash-001"
See more details in zerox documentation.
**zerox_kwargs:
**zerox_kwargs:
Arguments specific to the zerox function.
see datailed list of arguments here in zerox repository:
https://github.com/getomni-ai/zerox/blob/main/py_zerox/pyzerox/core/zerox.py#L25
Expand Down