Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: AzureOCRDocumentConverter - forward declaration of AnalyzeResult types #7523

Merged
merged 1 commit into from
Apr 10, 2024
Merged
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
forward declaration of AnalyzeResult
  • Loading branch information
anakin87 committed Apr 10, 2024
commit 043c50a4675185b66625bd7abbc775b098ef7b7d
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.