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

feat: Use forward reference for AnalyzeResult #6030

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented Oct 11, 2023

Why

The static method _convert_azure_result_to_document in the AzureOCRDocumentConverter class was causing a NameError due to the direct use of AnalyzeResult from the azure.ai.formrecognizer package, which is an optional dependency. This PR addresses this issue to ensure smooth functionality even when the optional package isn't installed.

What

The fix involves using a forward reference for AnalyzeResult in the method signature of _convert_azure_result_to_document.

How Can It Be Used

After this fix, users won't get the NameError as before. If they do have the package and want to utilize the full functionality, they can do so without any errors.

How Did You Test It

  1. Ran the code without the azure.ai.formrecognizer package installed to ensure no NameError is thrown.
  2. Installed the azure.ai.formrecognizer package and tested the full functionality of the AzureOCRDocumentConverter class to ensure it works as expected.

@vblagoje vblagoje requested a review from a team as a code owner October 11, 2023 14:10
@vblagoje vblagoje requested review from masci and ZanSara and removed request for a team and masci October 11, 2023 14:10
@vblagoje vblagoje added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Oct 11, 2023
@vblagoje
Copy link
Member Author

@masci assigning to Sara as she has the offline context already

@vblagoje vblagoje added the 2.x Related to Haystack v2.0 label Oct 11, 2023
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@vblagoje vblagoje merged commit 4b8b6e9 into main Oct 11, 2023
18 of 19 checks passed
@vblagoje vblagoje deleted the fix_azure_reference branch October 11, 2023 14:33
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 ignore-for-release-notes PRs with this flag won't be included in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AnalyzeResult Type Error in `AzureOCRDocumentConverter
2 participants