forward declaration of AnalyzeResult (#7523)

This commit is contained in:
Stefano Fiorucci 2024-04-10 09:02:08 +02:00 committed by GitHub
parent 39be515ba6
commit 843376bb1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -185,7 +185,7 @@ class AzureOCRDocumentConverter:
docs = [*tables, text]
return docs
def _convert_tables(self, result: AnalyzeResult, meta: Optional[Dict[str, Any]]) -> List[Document]:
def _convert_tables(self, result: "AnalyzeResult", meta: Optional[Dict[str, Any]]) -> List[Document]:
"""
Converts the tables extracted by Azure's Document Intelligence service into Haystack Documents.
:param result: The AnalyzeResult Azure object
@ -294,7 +294,7 @@ class AzureOCRDocumentConverter:
return converted_tables
def _convert_to_natural_text(self, result: AnalyzeResult, meta: Optional[Dict[str, Any]]) -> Document:
def _convert_to_natural_text(self, result: "AnalyzeResult", meta: Optional[Dict[str, Any]]) -> Document:
"""
This converts the `AnalyzeResult` object into a single Document. We add "\f" separators between to
differentiate between the text on separate pages. This is the expected format for the PreProcessor.

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Forward declaration of `AnalyzeResult` type in `AzureOCRDocumentConverter`.
`AnalyzeResult` is already imported in a lazy import block.
The forward declaration avoids issues when `azure-ai-formrecognizer>=3.2.0b2` is not installed.