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

AnalyzeResult Type Error in `AzureOCRDocumentConverter #6028

Closed
vblagoje opened this issue Oct 11, 2023 · 1 comment · Fixed by #6030
Closed

AnalyzeResult Type Error in `AzureOCRDocumentConverter #6028

vblagoje opened this issue Oct 11, 2023 · 1 comment · Fixed by #6030
Assignees
Labels
2.x Related to Haystack v2.0

Comments

@vblagoje
Copy link
Member

vblagoje commented Oct 11, 2023

Description:

The static method _convert_azure_result_to_document in the AzureOCRDocumentConverter class has a type hint for AnalyzeResult in its method signature. The issue is that AnalyzeResult comes from the azure.ai.formrecognizer package, which is an optional dependency for our project. This leads to a NameError when the package isn't installed.

Stack Trace:

NameError                                 Traceback (most recent call last)
<ipython-input-4-808600d3e9ab> in <cell line: 6>()
      4 from haystack.preview.components.builders.prompt_builder import PromptBuilder
      5 from haystack.preview.components.fetchers import LinkContentFetcher
----> 6 from haystack.preview.components.file_converters import HTMLToDocument
      7 from haystack.preview.components.generators.openai.gpt import GPTGenerator, default_streaming_callback
      8 from haystack.preview.components.routers.file_type_router import FileTypeRouter

2 frames
/usr/local/lib/python3.10/dist-packages/haystack/preview/components/file_converters/azure.py in AzureOCRDocumentConverter()
     93 
     94     @staticmethod
---> 95     def _convert_azure_result_to_document(result: AnalyzeResult, id_hash_keys: List[str], file_suffix: str) -> Document:
     96         """
     97         Convert the result of Azure OCR to a Haystack text Document.

NameError: name 'AnalyzeResult' is not defined
@vblagoje vblagoje added the 2.x Related to Haystack v2.0 label Oct 11, 2023
@vblagoje vblagoje self-assigned this Oct 11, 2023
@vblagoje
Copy link
Member Author

Fixed with #6030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant