Skip to content

Commit

Permalink
forward declaration of AnalyzeResult (#7523)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Apr 10, 2024
1 parent 39be515 commit 843376b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions haystack/components/converters/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _convert_tables_and_text(self, result: "AnalyzeResult", meta: Optional[Dict[
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
Expand Down Expand Up @@ -294,7 +294,7 @@ def _convert_tables(self, result: AnalyzeResult, meta: Optional[Dict[str, Any]])

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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 843376b

Please sign in to comment.